Customer makes order
Актери
- Customer
Scenario steps
- Customer logs in
- Customer browses menu
- Customer adds items to order
- Customer enters delivery details
- Customer pays and submits order
- Employee accepts orders
- Employee prepares and ships order
SQL Queries
SELECT user FROM users where email ='test2@hotmail.com' -- and password application check
SELECT name, price, id FROM products;
INSERT INTO orders(id) VALUES (4); INSERT INTO online_orders(order_id,delivery_address,customer_id) VALUES (4,'Mladinska 2', 2); INSERT INTO order_items( order_id, product_id, is_processed, price, quantity) SELECT 4,1,true, price, 3 FROM products WHERE id=1;
INSERT INTO order_items( order_id, product_id, is_processed, quantity) VALUES (4,2,true,1);
INSERT INTO payments(id, order_id, amount, payment_type, tip_amount) VALUES (2,4,550, ‘card’, 0); UPDATE orders SET status=’PLACED’ WHERE id=4;
CREATE VIEW order_details_view AS
SELECT
o.id AS order_id,
o.status,
oo.delivery_address,
u.name AS customer_name,
oi.product_id,
p.name AS product_name,
oi.is_processed,
oi.price,
oi.quantity,
pm.amount AS payment_amount,
pm.payment_type,
pm.tip_amount
FROM orders o
JOIN online_orders oo ON o.id = oo.order_id
JOIN users u ON oo.customer_id = u.id
JOIN order_items oi ON o.id = oi.order_id
JOIN products p ON oi.product_id = p.id
LEFT JOIN payments pm ON o.id = pm.order_id;
SELECT * FROM order_details_view WHERE order_id = 4;
UPDATE orders SET status='CONFIRMED' WHERE id=4;
Last modified
9 months ago
Last modified on 02/10/25 11:45:26
Note:
See TracWiki
for help on using the wiki.
