Skip to content

Hareline

singularName: runpluralName: runs

This table contains the run data and is the main table for the Hareline. It relates to the member table for the Hare and the locations table for the runsite. It is used by numerous other tables as reference

Schema

NameTypeDetails
run_nointeger
harerelationmanyToOne → Members
special_eventstringmust match ^[a-zA-Z0-9-. '()":&/();,!]+$
ononrichtext
run_datedate
coharestringmust match ^[a-zA-Z0-9-. ,&;():']+$
locationrelationmanyToOne → Locations
legacy_run_idinteger
summarystring
runnersrelationoneToMany → Runrecords
scribe_reportmedia
guestsrelationoneToMany → Guestrecords
run_startsstring
guest_harestringmust match ^[a-zA-Z0-9-. ()'äüöÄÜÖ]+$
onon_geostring
guest_feeinteger
guests_sign_insrelationoneToMany → Guests Sign-in
members_sign_insrelationoneToMany → Members Sign-in
onsite_salesrelationoneToMany → Onsite Sales
cash_expensesrelationoneToMany → Cash Expenses
event_bannerrelationoneToOne → Event Banner

Lifecycles

getRunSummary (async)

Retrieves a summary of a specific run by its ID.
The summary includes the run number, date, hare alias or guest hare, and location name. If the hare or location is not assigned, defaults to 'No Hare assigned' or 'No Location assigned'.

Parameters:

  • id: - The ID of the run to retrieve.

Returns:

  • object containing the run summary data.

beforeCreate (async)

This lifecycle method is triggered before creating a new run entry. It ensures that the run number and date are assigned if not provided, by incrementing from the last run's details. Additionally, it validates whether the assigned hare is permitted to set runs based on their active status and exemption flag. Throws an error if the hare is not allowed.

Parameters:

  • event: - The event object containing the parameters for the new run entry.

beforeUpdate (async)

This lifecycle method is triggered before updating an existing run entry. It checks whether the assigned hare is permitted to set runs based on their active status and exemption flag. Throws an error if the hare is not allowed.

Parameters:

  • event: - The event object containing the parameters for the updated run entry.

afterCreate (async)

This lifecycle method is triggered after creating a new run entry. It fetches the run summary and updates the run record with the summary.

Parameters:

  • event: - The event object containing the newly created run record.

afterUpdate (async)

This lifecycle method is triggered after updating a run entry. It fetches the updated run summary and compares it with the existing summary. If there is a difference, it updates the run record with the new summary. Handles errors during the process by logging them.

Parameters:

  • event: - The event object containing the updated run record.

Services

runInfoComplex (async)

Retrieve all runs within the given date range with additional information on the previous run's hare and hare's runs, the location and the OnOn.

Parameters:

  • startDate: The start date of the range in ISO format (YYYY-MM-DD).
  • endDate: The end date of the range in ISO format (YYYY-MM-DD).

Returns:

  • object with a single property "data" which is an array of run summaries.
    Each run summary object contains the following properties:
    - run_no: The run number.
    - run_date: The date of the run.
    - run_starts: The start time of the run.
    - geoLinks: An array of objects with "link" and "icon" properties for the location.
    - ononLinks: A string with OnOn links in markdown format.
    - run: An array of objects with "idx", "icon", "title", "subtitle", and "type" properties.
    - hare: An object with "name", "hare_image_url", and "run_data" properties.
    - attendees: An array of strings with the aliases of the members who attended the run.
    - scribe_report: An object with "url" property.

runInfo (async)

Retrieves an array of run summaries between the given start and end dates.
The run summaries are objects containing the run number, date, special event flag, guest fee, hare information (name, image), and an array of run details (date, start time, location, hare, and special event flag). The location is linked to the location detail page.

Parameters:

  • startDate: The start date of the range, in ISO format (YYYY-MM-DD).
  • endDate: The end date of the range, in ISO format (YYYY-MM-DD).

Returns:

  • object containing the data property, which is an array of run summaries.

runPlanning (async)

Retrieves data for run planning.

Returns:

  • object containing 3 lists of data:
    - runs_after_today: A list of runs after today, ordered by run number in descending order.
    - runs_for_members: A list of the latest runs for all active members who are not exempted from haring, ordered by run number in descending order.
    - latest_members: A list of members who have joined in the last year, ordered by joined date in descending order.

Released under the MIT License.