Skip to content

Guestrecords

singularName: guestrecordpluralName: guestrecords

WARNING

This table is not visible in the Strapi admin panel. Access only through database

Stores the runs of all guests including payment information (fee & type)

Schema

NameTypeDetails
guestrelationmanyToOne → Guests
amount_paiddecimal
payment_typeenumerationone of [Not Paid, Cash, DuitNow]
runrelationmanyToOne → Hareline

Lifecycles

afterCreate (async)

Lifecycle method triggered after creating a new guest record. It updates the last_run_date of the guest to the most recent run date. It does this by finding all the runs of the guest, sorting them in descending order, and taking the first run date as the most recent. If no runs are found, it sets the last_run_date to null.

Parameters:

  • event: - The event object containing parameters and state from the creation process.

beforeDelete (async)

Lifecycle method triggered before deleting a guest record. It retrieves the associated guest details and stores the entity state for use in subsequent lifecycle events.

Parameters:

  • event: - The event object containing parameters and state.

afterDelete (async)

Lifecycle method triggered after deleting a guest record. It updates the last_run_date of the guest to the most recent run date after the deletion. This is done by finding all remaining guest records, sorting them by run date in descending order, and taking the most recent date. If no records are found, it sets the last_run_date to null.

Parameters:

  • event: - The event object containing parameters and state from the deletion process.

Released under the MIT License.