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À-ÖØ-öø-ÿĀ-ſƀ-ɏƠ-ơƯ-ư\u1E00-\u1EFF\u0300-\u036F .,'’\-()]+$ |
| last_name | string | must match ^[A-Za-zÀ-ÖØ-öø-ÿĀ-ſƀ-ɏƠ-ơƯ-ư\u1E00-\u1EFF\u0300-\u036F .,'’\-()]+$ |
| alias | string | must match ^[A-Za-zÀ-ÖØ-öø-ÿĀ-ſƀ-ɏƠ-ơƯ-ư\u1E00-\u1EFF\u0300-\u036F .,'’\-()]+$ |
| 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*\d){8,15}$)\+?\d+(?: \d+)*$ |
| 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À-ÖØ-öø-ÿĀ-ſƀ-ɏƠ-ơƯ-ư\u1E00-\u1EFF\u0300-\u036F .,'’\-()]+$ |
| emergency_contactmobile | string | must match ^(?=(?:\D*\d){8,15}$)\+?\d+(?: \d+)*$ |
| 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 |
| cards | relation | oneToMany → Cards |
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.
afterCreate (async)
Lifecycle method triggered after creating a new member entry. Creates a member card for the new member, unless the member is inactive (e.g. during data migration of already-resigned members).
Parameters:
event: - The event object containing the newly created 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.
afterUpdate (async)
Lifecycle method triggered after updating an existing member entry. Synchronizes the member's card with their active status: - If the member is set inactive (resigned), their active card is inactivated. - If the member is set active again (rejoined), a fresh card is created; the previous card remains inactive for historical reference. No action is taken if the active status was not part of the update.
Parameters:
event: - The event object containing the updated member entry and update parameters.
Services
bodyColor
Returns the pdf-lib RGB colour for a member type's card body band.
Parameters:
memberType:
Returns:
formatMemberId
Formats a member ID as B0001 (Beer) or S0001 (Non-Beer).
Parameters:
member_id:member_type:
Returns:
cardY
Returns the pdf-lib y-coordinate (bottom-left) for a card row on an A4 page.
Parameters:
row: - Zero-based row index.
Returns:
cardX
Returns the pdf-lib x-coordinate (bottom-left) for a card column on an A4 page.
Parameters:
col: - Column index (0 = left, 1 = right).
Returns:
wrapText
Split text into lines that each fit within maxW at the given font/size. Breaks on word boundaries where possible; hard-breaks a word only if a single word is already wider than maxW. Returns at most maxLines lines (last line truncated with "…" if needed).
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.
generateMemberCardsPDF (async)
Generate a DIN-A4 PDF with two business-card-sized membership cards side-by-side per row, colour-coded by member_type.
Parameters:
memberIds: Strapi record IDs. Empty = all active members.
Returns:
generateGuestCardsPDF (async)
Generate a DIN-A4 PDF with 5 × 2 "Honored Guest" cards. IDs run G0001–G0005, body colour #263238, Guest_Hare.png as photo.
Returns:
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.
