Order Status Workflow
- Complexity: High
- Stack: Full-stack (Backend-heavy)
As an admin user, I want to update order statuses through a defined workflow so that customers can track their order progress.
Description
The Order entity currently has no status field - orders are created via OrderController (POST /api/orders) and processed by OrderService using the strategy pattern for stock allocation, but there is no lifecycle tracking after creation. This story introduces a status field, a state machine that defines valid transitions, and provides an interface to manage order progression. Customers see their order's current status in the orders-overview-page and order-detail-page.
Order Statuses
| Status | Description |
|---|---|
NEW | Initial state - every order that is not saved yet |
SAVED | Order is saved but still editable (add/remove products, change delivery address, etc.) |
PLACED | Order is placed and no longer editable (waiting for delivery) |
CANCELED | Order is not valid anymore (will not be delivered) |
Order Status Flow
Acceptance Criteria
- [ ] New orders are created with status
NEWduring the existing order creation flow inOrderService - [ ] User can save an order:
NEW->SAVED(order becomes editable) - [ ] User can place an order:
NEW->PLACEDorSAVED->PLACED - [ ] Admin can cancel an order:
SAVED->CANCELEDorPLACED->CANCELED - [ ] Placed and canceled orders cannot be modified further
- [ ] Attempting an invalid transition (e.g.,
CANCELED->NEW) returns a clear error - [ ] Admin order detail page shows the current status and only valid next-status actions
- [ ] Customers see the current status of their orders in
orders-overview-page(viaorder-card) andorder-detail-page - [ ] Non-admin users cannot cancel orders
- [ ] Status changes persist after page reload