Skip to content

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

NameTypeDetails
member_idinteger
first_namestringmust match ^[a-zA-Z-. ,()äöüÄÖÜ]+$
last_namestringmust match ^[a-zA-Z-. ()'äüöÄÜÖ]+$
aliasstringmust match ^[a-zA-Z0-9-. ,()'äöüÄÖÜ]+$
activeboolean
genderenumerationone of [Male, Female, Other, Not available]
nationalityenumerationone 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]
emailemail
mobilestringmust match ^(?:\+?\d{1,4}[-.\s]?)?(?:\(?\d{1,4}\)?[-.\s]?)?(\d{1,4}[-.\s]?){1,4}\d{1,4}$
dobdate
mailing_listboolean
member_typeenumerationone of [Beer, Non-Beer, Overseas, Retired]
joined_datedate
last_awardstring
year_givenstringmust match `^(19
previous_runsinteger
notesrichtext
emergency_contactnamestringmust match ^[a-zA-Z-., ()]+$
emergency_contactmobilestringmust match ^(?:\+?\d{1,4}[-.\s]?)?(?:\(?\d{1,4}\)?[-.\s]?)?(\d{1,4}[-.\s]?){1,4}\d{1,4}$
resigned_datedate
imagemedia
loa_startdate
loa_enddate
hare_for_runsrelationoneToMany → Hareline
tshirt_sizerelationmanyToOne → Tshirt-Sizes
actual_runsinteger
runsrelationoneToMany → Runrecords
hare_exemptionboolean
rejoined_datedate
waist_sizeinteger
force_creationboolean
members_sign_insrelationoneToMany → Members Sign-in
onsite_salesrelationoneToMany → Onsite Sales
office_functionrelationoneToOne → 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: members and run. members is an array of objects with alias, member_type, on_leave, and mobile properties. run is an object with run_no, run_date, location, hare, and guest_fee properties.

addCategoryPage (async)

addGuestsPage (async)

addMemberRow

drawTableHeader

Released under the MIT License.