---
# System prepended metadata

title: Backend Changes
tags: [order-options]

---

# Backend Changes

## Database Tables

**Order Option Types** `order_option_types`
- *system-wide order option types*

| Column            | Type     | Description                                                                                        |
| ----------------- | -------- |:-------------------------------------------------------------------------------------------------- |
| id                | int      | the order option type id                                                                           |
| type              | string   | the order option type that is passed in by the clients                                             |
| display           | string   | the text displayed on client platforms                                                             |
| order_instruction | string   | the text appended to order instructions when the order information is delivered to the restaurants |
| created_at        | datetime | the date and time db entry was created                                                             |
| updated_at        | datetime | the date and time db entry was updated                                                             |

**Order Options** `order_options`
- *the list of order options that selected by the user on checkout*

| Column               | Description                            |
| -------------------- |:-------------------------------------- |
| order_id             | The order id                           |
| order_option_type_id | the order option type id               |
| created_at           | the date and time db entry was created |
| update_at            | the date and time db entry was updated |

![](https://i.imgur.com/n1RWfiH.png)

---

## Classes

![](https://i.imgur.com/V6gmFb2.png)


## Tickets
* Create db migration scripts for `order_option_types` and `order_options`.
* Append the `contact-free delivery` message to the order instructions in the PDF that is sent to the restaurants via fax and email.
* Update the Create order endpoint in myradmin
    * with `order_options` in the body of the request
    * populate the `order_options` table
* Update the Get order endpoint response in myradmin
    * append the `contact-free delivery` message in the order instructions
    * return `order-options`


---
## Future Considerations
**Shop Order Options** `shop_order_options` *(optional)*
- *list of order options available to a shop*

| Column               | Type     | Description                                       |
|:-------------------- |:-------- |:------------------------------------------------- |
| shop_id              | int      | the shop id                                       |
| order_option_type_id | int      | the order option type id                          |
| active               | bool     | whether this option is active or not for the shop |
| created_at           | datetime | the date and time db entry was created            |
| updated_at           | datetime | the date and time db entry was updated            |


###### tags: `order-options`