Members
singularName: memberpluralName: members
Holds all members data for active and inactive members. Relates to run table and runrecords. Various fields to steer membership duration and type
Schema
| Name | Type | Details |
|---|---|---|
| member_id | integer | |
| first_name | string | must match ^[a-zA-Z-. ,()äöüÄÖÜ]+$ |
| last_name | string | must match ^[a-zA-Z-. ()'äüöÄÜÖ]+$ |
| alias | string | must match ^[a-zA-Z0-9-. ,()'äöüÄÖÜ]+$ |
| active | boolean | |
| gender | enumeration | one of [Male, Female, Other, Not available] |
| nationality | enumeration | one of [Afghanistan, Akrotiri, Albania, Algeria, American Samoa, Andorra, Angola, Anguilla, Antarctica, Antigua and Barbuda, Argentina, Armenia, Aruba, Ashmore and Cartier Islands, Australia, Austria, Azerbaijan, Bahamas, The, Bahrain, Baker Island, Bangladesh, Barbados, Bassas da India, Belarus, Belgium, Belize, Benin, Bermuda, Bhutan, Bolivia, Bosnia and Herzegovina, Botswana, Bouvet Island, Brazil, British Indian Ocean Territory, British Virgin Islands, Brunei, Bulgaria, Burkina Faso, Burma, Burundi, Cabo Verde, Cambodia, Cameroon, Canada, Cayman Islands, Central African Republic, Chad, Chile, China, Christmas Island, Clipperton Island, Cocos (Keeling) Islands, Colombia, Comoros, Congo, Democratic Republic of the, Congo, Republic of the, Cook Islands, Coral Sea Islands, Costa Rica, Cote d'Ivoire, Croatia, Cuba, Curacao, Cyprus, Czechia, Denmark, Dhekelia, Djibouti, Dominica, Dominican Republic, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea, Estonia, Eswatini, Ethiopia, Europa Island, Falkland Islands (Islas Malvinas), Faroe Islands, Fiji, Finland, France, France, Metropolitan, French Guiana, French Polynesia, French Southern and Antarctic Lands, Gabon, Gambia, The, Gaza Strip, Georgia, Germany, Ghana, Gibraltar, Glorioso Islands, Greece, Greenland, Grenada, Guadeloupe, Guam, Guatemala, Guernsey, Guinea, Guinea-Bissau, Guyana, Haiti, Heard Island and McDonald Islands, Holy See (Vatican City), Honduras, Hong Kong, Howland Island, Hungary, Iceland, India, Indonesia, Iran, Iraq, Ireland, Isle of Man, Israel, Italy, Jamaica, Jan Mayen, Japan, Jarvis Island, Jersey, Johnston Atoll, Jordan, Juan de Nova Island, Kazakhstan, Kenya, Kingman Reef, Kiribati, Korea, North, Korea, South, Kosovo, Kuwait, Kyrgyzstan, Laos, Latvia, Lebanon, Lesotho, Liberia, Libya, Liechtenstein, Lithuania, Luxembourg, Macau, Madagascar, Malawi, Malaysia, Maldives, Mali, Malta, Marshall Islands, Martinique, Mauritania, Mauritius, Mayotte, Mexico, Micronesia, Federated States of, Midway Islands, Moldova, Monaco, Mongolia, Montenegro, Montserrat, Morocco, Mozambique, Myanmar, Namibia, Nauru, Navassa Island, Nepal, Netherlands, New Caledonia, New Zealand, Nicaragua, Niger, Nigeria, Niue, Norfolk Island, North Macedonia, Northern Mariana Islands, Norway, Oman, Pakistan, Palau, Palmyra Atoll, Panama, Papua New Guinea, Paracel Islands, Paraguay, Peru, Philippines, Pitcairn Islands, Poland, Portugal, Puerto Rico, Qatar, Reunion, Romania, Russia, Rwanda, Saint Barthelemy, Saint Helena, Ascension, and Tristan da Cunha, Saint Kitts and Nevis, Saint Lucia, Saint Martin, Saint Pierre and Miquelon, Saint Vincent and the Grenadines, Samoa, San Marino, Sao Tome and Principe, Saudi Arabia, Senegal, Serbia, Seychelles, Sierra Leone, Singapore, Sint Maarten, Slovakia, Slovenia, Solomon Islands, Somalia, South Africa, South Georgia and the Islands, South Sudan, Spain, Spratly Islands, Sri Lanka, Sudan, Suriname, Svalbard, Sweden, Switzerland, Syria, Taiwan, Tajikistan, Tanzania, Thailand, Timor-Leste, Togo, Tokelau, Tonga, Trinidad and Tobago, Tromelin Island, Tunisia, Turkey (Turkiye), Turkmenistan, Turks and Caicos Islands, Tuvalu, Uganda, Ukraine, United Arab Emirates, United Kingdom, United States, United States Minor Outlying Islands, Uruguay, Uzbekistan, Vanuatu, Venezuela, Vietnam, Virgin Islands, Virgin Islands (UK), Virgin Islands (US), Wake Island, Wallis and Futuna, West Bank, Western Sahara, Western Samoa, World, Yemen, Zaire, Zambia, Zimbabwe, Not available] |
| mobile | string | must match ^(?:\+?\d{1,4}[-.\s]?)?(?:\(?\d{1,4}\)?[-.\s]?)?(\d{1,4}[-.\s]?){1,4}\d{1,4}$ |
| dob | date | |
| mailing_list | boolean | |
| member_type | enumeration | one of [Beer, Non-Beer, Overseas, Retired] |
| joined_date | date | |
| last_award | string | |
| year_given | string | must match `^(19 |
| previous_runs | integer | |
| notes | richtext | |
| emergency_contactname | string | must match ^[a-zA-Z-., ()]+$ |
| emergency_contactmobile | string | must match ^(?:\+?\d{1,4}[-.\s]?)?(?:\(?\d{1,4}\)?[-.\s]?)?(\d{1,4}[-.\s]?){1,4}\d{1,4}$ |
| resigned_date | date | |
| image | media | |
| loa_start | date | |
| loa_end | date | |
| hare_for_runs | relation | oneToMany → Hareline |
| tshirt_size | relation | manyToOne → Tshirt-Sizes |
| actual_runs | integer | |
| runs | relation | oneToMany → Runrecords |
| hare_exemption | boolean | |
| rejoined_date | date | |
| waist_size | integer | |
| force_creation | boolean | |
| members_sign_ins | relation | oneToMany → Members Sign-in |
| onsite_sales | relation | oneToMany → Onsite Sales |
| office_function | relation | oneToOne → Committee |
Lifecycles
beforeCreate (async)
Lifecycle method triggered before creating a new member entry. It validates waist size input, checks for duplicate members based on date of birth, assigns a new member_id if none was provided, and sets default values for joined_date and alias if not provided.
Parameters:
event: - The event object containing the parameters for the new member entry.
beforeUpdate (async)
Lifecycle method triggered before updating an existing member entry. It validates waist size input and automatically updates the resigned_date and rejoined_date fields when the active status of the member is changed.
Parameters:
event: - The event object containing the parameters for the updated member entry.
Services
actualRuns (async)
Retrieves the actual number of runs for a given member id.
Parameters:
id: - The id of the member to retrieve the actual runs for.
Returns:
- object with the actual number of runs for the member.
generatePDF (async)
Generates a PDF document containing sign-in sheets for members and guests.
This function creates a PDF with separate pages for beer and non-beer drinker member categories, as well as a page for guests. Each page includes a header and a data table. If the number of rows in the table is less than 35, row heights are adjusted to fill the page; otherwise, additional pages are created.
Parameters:
members: - An array of member objects, each containing member details such as member type.run: - An object containing run details, including run number, date, and guest fee.
Returns:
- A buffer containing the bytes of the generated PDF document.
getSignInData (async)
Fetches all active members based on their join/rejoin dates, and also marks members on LOA.
WARNING: this function is implemented directly in the controller, this is a dummy only
Parameters:
runDate: - The date of the run to fetch sign-in data for.
Returns:
- object with two properties:
membersandrun.membersis an array of objects withalias,member_type,on_leave, andmobileproperties.runis an object withrun_no,run_date,location,hare, andguest_feeproperties.
