Sales Items
singularName: sales-itempluralName: sales-items
Table to store all sales items available for purchase. A number of category fiels are required to combine all in one table. The items are effective dated
Schema
| Name | Type | Details |
|---|---|---|
| item_type | enumeration | one of [Drinks, Subscriptions, Other] |
| item_name | string | |
| item_price | integer | |
| start_date | date | |
| end_date | date | |
| onsite_sales | relation | oneToMany → Onsite Sales |
| item_subtype | enumeration | one of [Beer, Non-Beer] |
Lifecycles
beforeUpdate (async)
This lifecycle method is triggered before updating a sales item entry. It checks for any changes in the entry's fields and ensures that updates to certain fields like 'item_price', 'item_type', and 'item_subtype' are not allowed. If these fields are attempted to be updated, an error is thrown indicating that these fields cannot be modified and a new item should be created instead.
Parameters:
event: - The event object containing parameters and state from the update process.
