UNPKG

alpha-version-dce-check-in-api

Version:

API for taking attendance and checking people in.

42 lines (36 loc) 1.06 kB
// Import dce-reactkit import { genRouteHandler, ParamType } from '../../../../dce-reactkit'; // Import shared types import Router from '../../../types/Router'; // Import shared helpers import createOccurrence from '../../../shared/helpers/createOccurrence'; /** * Endpoint for inserting a new occurrence. * Body of request must contain a valid Occurrence. * @author Ben Arnarsson * @param app the Express app which we are adding this endpoint to. */ const addCreateOccurrenceRoute = ( router: Router, ) => { /** * Get the list of apps and a map of which apps are installed * @author Ben Arnarsson * @param [occurrence] the Occurrence that we are adding to the collection. */ router.post( '', genRouteHandler({ paramTypes: { occurrence: ParamType.JSON, }, handler: async ({ params }) => { // Destructure params const { occurrence } = params; // Create the occurrence await createOccurrence(occurrence); }, }), ); }; export default addCreateOccurrenceRoute;