wiki:ImportatntUseCase003

Version 1 (modified by 221128, 12 days ago) ( diff )

--

EMPLOYEE MANAGES ORDER

Actors

  • Employee

Steps in the Scenario

1. Employee opens tab.

SELECT p.name, p.price, oi.quantity FROM order_items oi JOIN products p ON p.id = oi.product_id WHERE oi.order_id = 1;

2. Employee adds order items.

INSERT INTO order_items(id, order_id, product_id, is_processed, quantity) VALUES (7,1,1,false,1); INSERT INTO order_items(id ,order_id, product_id, is_processed, quantity) VALUES (8,1,2,false,1);

3. Employee marks order items as processed.

UPDATE order_items SET is_processed=true WHERE id=7; UPDATE order_items SET is_processed=true WHERE id=8;

4. Employee closes tab.

5. System prints bil.

UPDATE orders SET status='CONFIRMED' WHERE id=1;

6. Employee finalizes payment.

INSERT INTO payments(id, order_id, amount, payment_type, tip_amount) SELECT 3,1, SUM(oi.price), ‘cash’, 0 FROM order_items oi WHERE oi.order_id = 1

Note: See TracWiki for help on using the wiki.