Services Overview
INFO
Services can be implemented either as part of a specific collection type or completely independent from a collection type. If implemented as part of a collection type the route, controller and service files are stored under src/api/collection-name/. If implemented independent of a collection type, the files are stored in the src/routes and src/controllers folder.
| Collection | Service | Details | Functionality |
|---|---|---|---|
| Cards | bulkCreateGuestCards | Implemented in:services/card.jsEndpoint: POST /cards/guest/bulkController: controllers/card.js | Creates multiple guest cards with a continuous guest_number sequence, starting from the current maximum. The card_uid for each card is generated automatically by the card beforeCreate lifecycle hook. |
deactivateCard | Implemented in:services/card.jsEndpoint: PUT /cards/:documentId/deactivateController: controllers/card.js | Deactivates a card by setting is_active to false. Returns null if no card with the given documentId exists. | |
generateMemberCardImage | Implemented in:services/cardImage.jsEndpoint: GET /cards/image-previewController: controllers/card.js | Generate a PNG image of a member card identical in layout to the PDF version. | |
generateCardsPDF | Implemented in:services/cardPdf.jsEndpoint: GET /cards/printController: controllers/card.js | Generate a DIN-A4 PDF of member and/or guest cards. Each card is printed twice side-by-side per A4 row with dashed cut guides. | |
| Members | actualRuns | Implemented in:services/member.jsEndpoint: GET /members/:id/actual-runsController: controllers/actualruns.js | Retrieves the actual number of runs for a given member id. |
generateMemberCardsPDF | Implemented in:services/memberCards.jsEndpoint: GET /members/membership-cardsController: controllers/member-cards.js | Generate a DIN-A4 PDF with two business-card-sized membership cards side-by-side per row, colour-coded by member_type. | |
generateGuestCardsPDF | Implemented in:services/memberCards.jsEndpoint: GET /members/guest-cardsController: controllers/member-cards.js | Generate a DIN-A4 PDF with 5 × 2 "Honored Guest" cards. IDs run G0001–G0005, body colour #263238, Guest_Hare.png as photo. | |
generatePDF | Implemented in:services/signin.jsEndpoint: GET /members/download-pdfController: controllers/signin.js | 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. | |
getSignInData | Implemented in:services/signin.jsEndpoint: GET /members/getsigninjsonController: controllers/signin.js | 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 | |
| Onsite Sales | generatePDF | Implemented in:services/financialReport.jsEndpoint: GET /onsite-sales/financial-reportController: controllers/financial-report.js | Generates a PDF report document for a specific run date. This function creates a PDF document consisting of a financial report page and an appendix page containing the transaction details. The document is formatted with specific layout dimensions and includes headers, tables, and fonts. Financial data is fetched based on the provided run date, and the resulting PDF is returned as a buffer. |
| Hareline | runInfoComplex | Implemented in:services/run.jsEndpoint: GET /runs/run-info-complexController: controllers/runinfo.js | 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. |
runInfo | Implemented in:services/run.jsEndpoint: GET /runs/run-infoController: controllers/runinfo.js | 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. | |
runPlanning | Implemented in:services/run.jsEndpoint: GET /runs/run-planningController: controllers/runinfo.js | Retrieves data for run planning. | |
| No Collection | generate | Endpoint:GET /metabase-tokenController: controllers/metabase-token.js | Signs a JWT token and returns the Metabase embed URL for the requested dashboard. |
head | Endpoint:HEAD /pingController: controllers/ping.js | Minimal 204 response used by the frontend to detect online/offline status. |
