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>
21 lines
1.2 KiB
JavaScript
21 lines
1.2 KiB
JavaScript
const express = require('express');
|
|
const rateLimit = require('express-rate-limit');
|
|
const router = express.Router();
|
|
const { joinWaitlist, myWaitlist, leaveWaitlist, claimInfo, eventWaitlist, offerManually, moveEntry, removeEntry } = require('../controllers/waitlistController');
|
|
const { protect, staff, supervisor, optionalAuth } = require('../middleware/authMiddleware');
|
|
const { scopeEvent } = require('../utils/campusScope');
|
|
|
|
// Claim links are credentials, so keep guessing slow.
|
|
const claimLimiter = rateLimit({ windowMs: 60 * 1000, max: 30, message: { message: 'Too many attempts. Please try again in a minute.' } });
|
|
|
|
router.post('/', optionalAuth, joinWaitlist);
|
|
router.get('/mine', protect, myWaitlist);
|
|
router.get('/claim/:token', claimLimiter, claimInfo);
|
|
router.get('/events/:eventId', protect, staff, scopeEvent(), eventWaitlist);
|
|
router.post('/:id/offer', protect, supervisor, scopeEvent({ resolve: 'waitlistEntry' }), offerManually);
|
|
router.post('/:id/move', protect, supervisor, scopeEvent({ resolve: 'waitlistEntry' }), moveEntry);
|
|
router.post('/:id/remove', protect, supervisor, scopeEvent({ resolve: 'waitlistEntry' }), removeEntry);
|
|
router.delete('/:id', protect, leaveWaitlist);
|
|
|
|
module.exports = router;
|