Lifecycle Functions Overview
INFO
The following table shows only collection types which have a lifecylce and the lifecycles types which are implemented
| Collection | Trigger | Functionality |
|---|---|---|
| Alternative Directions | beforeCreate | - add runsite_name for better readbility |
| Applicants | afterCreate | - if status draft: send out confirmation email to applicant - if status draft: send out information email to reviewer - if status published: create a memberentry |
| Cash Expenses | beforeCreate | - enforce that for expense_type= Free Text free_text_item_content is filled- enforce amount_spent is not null |
| Event Banner | beforeCreate | - validate start_date and end_date are properly set to enforce only one Event Banner at a time |
beforeUpdate | - validate start_date and end_date are properly set to enforce only one Event Banner at a time | |
| Guestrecords | beforeDelete | - read the state of the record to be used in afterDelete |
afterCreate | - lookup all runs for the guest and update last_run_date in guest | |
| Guests | beforeCreate | - enforce contact_no has minimum 8 digits- allow contact_no to be any number if starts with +00- enforce contact_no duplicate check on last 10 digits |
| Guests Sign-in | beforeCreate | - enforce duplicate check on entry |
beforeDelete | - read the state of the record to be used in afterDelete | |
afterCreate | - create the related guest-record | |
afterUpdate | - find the related guest-record and update payment_type and guest_fee there | |
afterDelete | - delete the related guest-record | |
| Hareline | beforeCreate | - set run_no and run_date- enforce the hare member to be active and not exempted from setting runs |
beforeUpdate | - enforce the hare member to be active and not exempted from setting runs | |
afterCreate | - create and set the run_summary for the run record | |
| Locations | beforeCreate | - prune latitude and longitude to max 4 decimal places- create the navigation links for Google, Waze and OSM - enforce duplicate check for existing locations closer than 500m |
beforeUpdate | - prune latitude and longitude to max 4 decimal places- create the navigation links for Google, Waze and OSM | |
| Members | beforeCreate | - enforce waist_sizeto be an even number between 24 and 60- enforce duplicate check based on dob- set member_id to next id- set date_joined to today- set alias to first_name last_name if no aliasprovided |
beforeUpdate | - enforce waist_sizeto be an even number between 24 and 60- toogle resigned_date and rejoined_date based on activestatus before and after | |
| Members Sign-In | beforeCreate | - enforce duplicate check on entry |
beforeDelete | - read the state of the record to be used in afterDelete | |
afterCreate | - create the related runrecord | |
afterDelete | - delete the related runrecord | |
| Onsite Sales | beforeCreate | '- enforce either member or guest are filled (must have one but not both)- enforce that sales_item is filled- enforce that sales_item is not outdated- enforce that only members can purchase subscriptions - enforce that Beer Members can only purchase Beer Type subscriptions - enforce that Non-Beer Members can only purchase Non-Beer Type subscriptions |
| Runrecords | beforeCreate | - create and set run_summary and member_alias fields |
beforeUpdate | - enforce no updates on runrecords | |
beforeDelete | - call /members/actualruns and update members actual_runs field | |
afterCreate | - call /members/actualruns and update members actual_runs field | |
| Sales Items | beforeUpdate | - enforce no updates for item_price, item_type, item_subtype |
