Skip to content

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

NameTypeDetails
full_namestring
contact_nostring
runsrelationoneToMany → Guestrecords
last_run_datedate
archivedboolean
guests_sign_insrelationoneToMany → Guests Sign-in
onsite_salesrelationoneToMany → Onsite Sales
idem_guestcreaterelationoneToOne → 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.

Released under the MIT License.