Guests
singularName: guestpluralName: guests
Table to hold the guest data records. Only guest data stored here, no run relation. Records will be anoymized three month after last run with chapter
Schema
| Name | Type | Details |
|---|---|---|
| full_name | string | |
| contact_no | string | |
| runs | relation | oneToMany → Guestrecords |
| last_run_date | date | |
| archived | boolean | |
| guests_sign_ins | relation | oneToMany → Guests Sign-in |
| onsite_sales | relation | oneToMany → Onsite Sales |
| idem_guestcreate | relation | oneToOne → Idem-guestcreate |
Lifecycles
beforeCreate (async)
Lifecycle event triggered before creating a guest record.
- Retrieves all guests not marked as archived to check for duplicates.
- If the contact number does not start with '+00', it performs a duplicate check:
- Normalizes the mobile number to a 10-digit format.
- Ensures the mobile number has at least 8 digits, excluding spaces and '+'.
- Checks for existing guests with the same normalized mobile number.
- Throws an ApplicationError if the mobile number is too short or if a duplicate is found.
Parameters:
event: - The lifecycle event object containing the input data.
