> ## Documentation Index
> Fetch the complete documentation index at: https://higginsgraferinc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Patron

# Point of Service Patron API Flow

To provide the proper experience to patrons using the Point of Service (POS) API, you'll need to build the following capabilities:

1. Allow the patron to browse available dishes by category (appetizers, main course, drinks, and desserts).
2. Ensure the essential ingredients for the dish are in stock.
3. Allow the patron to view dish details prior to ordering.
4. Let the patron add a dish to their cart and view it.
5. Create the order in the system.
6. Confirm to the patron the order has been successfully placed.

## Step 1: Browse dishes by category

Patrons will start by browsing in the ordering app and should be able to view dishes specific to the category they select.

Available values for categories:

* `Appetizers`
* `Main Course`
* `Dessert`
* `Drinks`

### Request

The client sends an HTTP request to retrieve a list of dishes filtered by the selected `category`.

**Endpoint**: `GET /dishes`

```curl theme={null}
curl -X 'GET' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/dishes?filter=category.eq~{categoryName}' \
  -H 'accept: application/json'
```

### Response

If the request was successful, the server responds with a `200 okay` status code and a response body containing the list of dishes in that category.

Each dish object includes the following properties:

| Property                    | Type             | Description                                                                                                  |
| --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------ |
| `id`                        | string           | The dish id (required for calls later in this flow)                                                          |
| `created_at`                | string           | The date and time the dish was created. Uses ISO 8601 standard. Ex: `2025-04-05T14:55:03.824Z`               |
| `updated_at`                | string           | The date and time the dish was most recently updated. Uses ISO 8601 standard. Ex: `2025-04-05T14:55:03.824Z` |
| `name`                      | string           | The name of the dish.                                                                                        |
| `description`               | string           | The long-text description of the dish.                                                                       |
| `category`                  | enum string      | The category the dish belongs to. Values: `Appetizers`, `Main Course`, `Dessert`, and `Drinks`.              |
| `preparation_time`          | integer          | The time it takes to prepare the dish, in minutes.                                                           |
| `price`                     | number           | The price of the dish.                                                                                       |
| `image_name`                | string           | The name of the image associated with the dish, if available.                                                |
| `station`                   | enum string      | The name of the station the dish is prepared at. Values: `hot`, `cold`, `beverage`                           |
| `ingredients`               | array of objects | Object that contains the ingredient details of the ingredients included in the dish.                         |
| `ingredients.ingredient_id` | string           | The id of the ingredient (required for calls later in this flow)                                             |
| `ingredients.is_essential`  | boolean          | Indicates whether this ingredient is required to make this dish or not.                                      |
| `ingredients._id`           | string           | Some other id for the ingredient                                                                             |

## Step 2: Check ingredient quantities

Next, the client app must confirm the in stock quantities of the essential ingredients for the dishes.

### Request

The client sends HTTP requests to retrieve the `name` and `in_stock_qty` properties for each ingredient. You'll need the `ingredient_id` for each ingredient to check and you'll filter the response to include only the `in_stock_qty` and `name` fields.

**Endpoint**: `GET /ingredients/{id}`

```curl theme={null}
curl -X 'GET' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/ingredients/{ingredient_id}?fields=in_stock_qty|name' \
  -H 'accept: application/json'
```

### Response

If the request was successful, the server responds with a `200 okay` status code and a response body that includes the requested resource.

<Note>
  Any dishes that have essential ingredients with an `in_stock_qty` of `0` should display as `unavailable` in the client app so they cannot be added to an order.
</Note>

## Step 3: View dish details

The patron will select a dish to see its details.

### Request

The client sends HTTP requests to retrieve the `name`, `price`, `description`, and `ingredients` properties for the selected dish. For this call, you'll need the `id` for the selected dish.

**Endpoint**: `GET /dishes/{id}`

```curl theme={null}
curl -X 'GET' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/dishes/{id}?fields=name|price|description|ingredients' \
  -H 'accept: application/json'
```

### Response

If the request was successful, the server responds with a `200 okay` status code and a response body that includes the following properties:

| Property                    | Type             | Description                                                                         |
| --------------------------- | ---------------- | ----------------------------------------------------------------------------------- |
| `id`                        | string           | The dish id                                                                         |
| `name`                      | string           | The name of the dish.                                                               |
| `description`               | string           | The long-text description of the dish.                                              |
| `price`                     | number           | The price of the dish.                                                              |
| `image_name`                | string           | The name of the image associated with the dish, if available                        |
| `ingredients`               | array of objects | Object that contains the ingredient details of the ingredients included in the dish |
| `ingredients.ingredient_id` | string           | The id of the ingredient (required for calls later in this flow)                    |
| `ingredients.is_essential`  | boolean          | Indicates whether this ingredient is required to make this dish or not.             |
| `ingredients._id`           | string           | Some other id for the ingredient                                                    |

## Step 4: Add a dish and view the cart

The patron can now add the dish to their cart and then view the cart when they are ready to place their order. The client app keeps track of the dishes added to the cart.

## Step 5: Place the order

When the patron has finished adding dishes to their cart, they can then place their order.

This request requires authorization with a bearer token, as well as the following properties in the request body:

| Property           | Type             | Description                                                                          |
| ------------------ | ---------------- | ------------------------------------------------------------------------------------ |
| `name`             | string           | The name of the patron                                                               |
| `table_number`     | integer          | The patron's table number                                                            |
| `dish_ids`         | array of strings | The ids of all the dishes included in the order                                      |
| `special_requests` | string           | The text the patron included in the special request field of their order             |
| `scheduled_at`     | string           | *nullable* The date and time the order is scheduled to arrive, using ISO 8601 format |

### Request

The client sends an HTTP request with an authorization header and request body that includes the dish ids from local storage and the other required properties for the order.

**Endpoint**: `POST /orders`

```curl theme={null}
curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/orders' \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer {bearerToken}' \
  -d '{
    "name": "Sarah",
    "table_number": 13,
    "dish_ids": [
      "{id}"
    ],
    "special_requests": "None",
    "scheduled at": null
  }'
```

### Response

If the request was successful, the server responds with a `201 created` status code and a response body that includes the resource.

## Step 6: Confirm the order

The patron should receive a success message that says, "We've received your order!" upon the successful creation of the order.
