Repository with Kitchen production line resources
- Subscribes to
OrderCreated
events. - Adds the order to the orders list using the order ID as the key.
- Subscribes to
OrderPaymentConfirmed
events. - If the orders list contains the received OrderId:
- Adds
TrackingCode:OrderId
to theReceived
queue.
- Adds
- Received: Queue for orders that have been received.
- InPreparation: Queue for orders that are currently being prepared.
- Ready: Queue for orders that are ready for pickup or delivery.
- Endpoint: Lists all orders.
- Response Object:
{
"received": [
{
"orderId": "b39c3d69-2e43-47df-8b86-0037975ae211",
"code": "ASD-12"
}
],
"inPreparation":[
{
"orderId": "b33c3d69-2e43-47df-8b86-0037975ae211",
"code": "ASD-12"
}
],
"ready": [
{
"orderId": "c39c3d69-2e43-47df-8b86-0037975ae211",
"code": "ASD-22"
}
],
}
- Endpoint: Updates the status of an order.
- Request Parameters:
trackingCode
: The tracking code of the order.status
: The new status of the order. Valid statuses areInPreparation
,Ready
, orCompleted
.
- Status Change Rules:
- Status transitions must follow the sequence:
Received
->InPreparation
->Ready
->Completed
. - Status changes cannot be rolled back.
- If the order status is
Completed
, it should be removed from the orders list.
- Status transitions must follow the sequence:
- Events:
- An
OrderStatusChanged
event should be triggered on every status change operation.
- An
- Trigger: Executed from the
OrderPaymentConfirmed
event. - Actions:
- Adds the order to the
Received
queue. - Publishes an
OrderStatusChanged
event with the status valueReceived
.
- Adds the order to the
- Trigger: Executed when an order needs to be prepared.
- Actions:
- Removes the order from the
Received
queue. - Adds the order to the
InPreparation
queue. - Publishes an
OrderStatusChanged
event with the status valueInPreparation
.
- Removes the order from the
- Trigger: Executed when an order preparation is finished.
- Actions:
- Removes the order from the
InPreparation
queue. - Adds the order to the
Ready
queue. - Publishes an
OrderStatusChanged
event with the status valueReady
.
- Removes the order from the
- Trigger: Executed when an order is completed.
- Actions:
- Removes the order from the
Ready
queue. - Removes the order from the list.
- Publishes an
OrderStatusChanged
event with the status valueCompleted
.
- Removes the order from the