| Action | Method | Resource | Description |
|---|
| Get all | GET | /orders/:order_id/attachments | Get all attachments with order_id. |
| Get | GET | /orders/:order_id/attachments/:attachment_id | Get attachment with id order_id and attachment_id. |
| Create | POST | /orders/:order_id/attachments | Create a attachment with order_id. |
| Update | PUT | /orders/:order_id/attachments/:attachment_id | Update attachment with order_id and attachment_id. |
| Delete | DELETE | /orders/:order_id/attachments/:attachment_id | Delete attachment with order_id and attachment_id. |
The order attachment model is composed of the following attributes:
| Attribute | Type | Required | Description | Whereable |
|---|
| order_id | integer | no, required to create | The attachment's order. (Order ID). | No |
| user_id | integer | no, required to create | The attachment's user. (User ID). | Yes |
| type | integer | no, required to create | The attachment's type. | Yes |
| note | string | no, required if type 1 | The attachment's note. | No |
| file | base64 image, url image or File image | no, required if type 2, 3 and 4 | The attachment's file. | No |
The type of attachment is used to differentiate them from each other. Notes, images or signatures.
| Type number | Type Name | Description |
|---|
| 1 | Note | Attachment type 1 is used to add a note to an order in progress. |
| 2 | Image | Attachment type 2 allows to add pictures or images to an order. |
| 3 | First Signature | Attachment type 3 is an attachment with a signature this only can be added once. cannot be updated. |
| 4 | Second Signature | Attachment type 4 is an attachment with a signature this only can be added once. cannot be updated. |