Waiter

Order retrieval

GET /retrieve-order/:orderId

Before delivering orders, the Waiter will check whether any open jobs are done.

The Waiter checks whether all items for the order are present and not delivered, i.e. the number of jobs in a given order matches the orderSize and the orderDelivered is Null.

  • If the conditions are not met, the answer is
Code Content
503 {"message: "Order not ready"}
404 {"message: "Order unknown"}
410 {"message: "Order already delivered"}
  • If the conditions are met, the orderDelivered is updated for all jobs in the order it is returned.
{
  "orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
  "orderPlaced": "2019-08-01T00:00:00.000Z",
  "orderSize": 1,
  "coffees": [
    { "product": "COFFEE" }
  ],
  "orderDelivered": "2019-08-01T00:00:33.000Z"
}

Order history

GET /order-history

Return the entire order history.

[
  {
    "jobId": "00000000-2222-2222-2222-000000000000",
    "product": "KAKAO",
    "orderId" : "00000000-FFFF-FFFF-FFFF-000000000000",
    "orderPlaced" : "2019-07-31T01:00:00.000Z",
    "orderDelivered": "2019-07-31T01:10:00.000Z",
    "orderSize": 2,
    "machine": "http://localhost:1337",
    "jobStarted": "2019-07-31T01:00:01.000Z",
    "jobRetrieved": "2019-07-31T01:00:32.000Z"
  },
  {
    "jobId": "00000000-1111-1111-1111-000000000000",
    "product": "KAKAO",
    "orderId" : "00000000-FFFF-FFFF-FFFF-000000000000",
    "orderPlaced" : "2019-07-31T01:00:00.000Z",
    "orderDelivered": "2019-07-31T01:10:00.000Z",
    "orderSize": 2,
    "machine": "http://localhost:1337",
    "jobStarted": "2019-07-31T01:01:01.000Z",
    "jobRetrieved": "2019-07-31T01:01:32.000Z"
  },
  {
    "jobId": "00000000-BBBB-BBBB-BBBB-000000000000",
    "product": "COFFEE",
    "orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
    "orderPlaced": "2019-08-01T00:00:00.000Z",
    "orderDelivered": "2019-08-01T00:00:33.000Z",
    "orderSize": 1,
    "machine": "http://localhost:1337",
    "jobStarted": "2019-08-01T00:00:01.000Z",
    "jobRetrieved": "2019-08-01T00:00:32.000Z",
  }
]

Return the history for a specific order

GET /order-history/:orderId
[
  {
    "jobId": "00000000-BBBB-BBBB-BBBB-000000000000",
    "product": "COFFEE",
    "orderId": "00000000-AAAA-AAAA-AAAA-000000000000",
    "orderPlaced": "2019-08-01T00:00:00.000Z",
    "orderDelivered": "2019-08-01T00:00:33.000Z",
    "orderSize": 1,
    "machine": "http://localhost:1337",
    "jobStarted": "2019-08-01T00:00:01.000Z",
    "jobRetrieved": "2019-08-01T00:00:32.000Z",
  }
]

Collect all jobs

POST /collect-jobs

Ask the Cashier for all jobs via their /processed-jobs API and populate the memory by identifying jobIds. Then iterate over the memory for uncollected jobs before answering.

  • Payload
{
}
  • Response
Code Content
200 {"message: "X jobs collected, still waiting for Y jobs."}