UNPKG

alpha-version-dce-check-in-api

Version:

API for taking attendance and checking people in.

45 lines (37 loc) 1.06 kB
// Import dce-reactkit import { genRouteHandler, ParamType } from '../../../../dce-reactkit'; // Import types import Router from '../../../types/Router'; // Import shared types import Occurrence from '../../../shared/types/Occurrence'; // Import shared helpers import findOccurrence from '../../../shared/helpers/findOccurrence'; /** * Endpoint for retrieving an occurrence, * expects an occurrenceId generated from OccurrenceBasicInfo. * @author Benedikt Arnarsson * @param app the Express app which we are adding this endpoint to. */ const addGetOccurrenceRoute = ( router: Router, ) => { /** * // TODO: add JSDoc */ router.get( '', genRouteHandler({ paramTypes: { occurrenceId: ParamType.String, }, handler: async ({ params }): Promise<Occurrence> => { // Destructure params const { occurrenceId } = params; // Find occurrence const occurrence = await findOccurrence(occurrenceId); return occurrence; }, }), ); }; export default addGetOccurrenceRoute;