Youth events need a name and date of birth for every attendee, and a parent/guardian's details for under-18s. Parents get an email and WhatsApp link to a consent page that records the signed name, time, IP, device and exact consent text; medical and emergency details are stored encrypted. Tickets are issued but check-in is blocked until consent is given (supervisor override audited). A daily job sends reminders and purges medical details after the retention period. Adds a supervisor consent tracker, consent status and medical list reports, and clears consent data when an account is anonymised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
const express = require('express');
|
|
const rateLimit = require('express-rate-limit');
|
|
const router = express.Router();
|
|
const { getConsent, answerConsent, listEventConsent, resendRequest, resendPending, rerequestConsent, medicalList } = require('../controllers/consentController');
|
|
const { protect, staff, supervisor } = require('../middleware/authMiddleware');
|
|
|
|
// The token in the link is the parent's only credential, so keep guessing slow.
|
|
const consentLimiter = rateLimit({ windowMs: 60 * 1000, max: 30, message: { message: 'Too many attempts. Please try again in a minute.' } });
|
|
|
|
router.get('/events/:eventId', protect, staff, listEventConsent);
|
|
router.post('/events/:eventId/resend-pending', protect, supervisor, resendPending);
|
|
router.post('/events/:eventId/rerequest', protect, supervisor, rerequestConsent);
|
|
router.get('/events/:eventId/medical', protect, supervisor, medicalList);
|
|
router.post('/requests/:id/resend', protect, resendRequest);
|
|
|
|
// Public consent page
|
|
router.get('/:token', consentLimiter, getConsent);
|
|
router.post('/:token', consentLimiter, answerConsent);
|
|
|
|
module.exports = router;
|