Archived
UserCampusScope relation and audit action; scopeEvent/scopeList/unscopedOnly/ campusIndependent/scopeBroadcast markers; tests/campusScopeRoutes.test.js (still failing: events, payments, registrations, scan locks, tickets left). Can't delete a campus that has scoped staff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.6 KiB
JavaScript
27 lines
1.6 KiB
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const {
|
|
getRegister, markAttendance, exportRegister,
|
|
issueCertificates, revokeCertificate, sendCertificatesHandler, downloadEventCertificates, previewCertificate,
|
|
myCertificates, downloadCertificate, verifyCertificate,
|
|
} = require('../controllers/attendanceController');
|
|
const { protect, staff, supervisor } = require('../middleware/authMiddleware');
|
|
const { scopeEvent, campusIndependent } = require('../utils/campusScope');
|
|
|
|
// Certificates — fixed paths first so they aren't taken as an :eventId
|
|
router.get('/certificates/verify/:code', verifyCertificate);
|
|
router.get('/certificates/mine', protect, myCertificates);
|
|
router.post('/certificates/preview', protect, supervisor, campusIndependent('previews a certificate template from the request body'), previewCertificate);
|
|
router.get('/certificates/:id/pdf', protect, downloadCertificate);
|
|
router.post('/certificates/:id/revoke', protect, supervisor, scopeEvent({ resolve: 'certificate' }), revokeCertificate);
|
|
|
|
// Attendance register
|
|
router.get('/:eventId', protect, staff, scopeEvent(), getRegister);
|
|
router.get('/:eventId/export', protect, staff, scopeEvent(), exportRegister);
|
|
router.post('/:eventId/mark', protect, supervisor, scopeEvent(), markAttendance);
|
|
router.post('/:eventId/certificates', protect, supervisor, scopeEvent(), issueCertificates);
|
|
router.post('/:eventId/certificates/send', protect, supervisor, scopeEvent(), sendCertificatesHandler);
|
|
router.get('/:eventId/certificates.pdf', protect, supervisor, scopeEvent(), downloadEventCertificates);
|
|
|
|
module.exports = router;
|