Events, payments, registrations, scan locks and tickets marked; list controllers filtered (registrations, payments, tickets, scans, stats, coupons, scheduled messages, form responses, funnel). Owner-or-staff routes check staff against the record's event (ownerOk). Scanner names the campus of another campus's ticket. Route test passes; unit tests for the rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
893 B
JavaScript
17 lines
893 B
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const { listCoupons, getCoupon, createCoupon, updateCoupon, validateCode, listRedemptions } = require('../controllers/couponController');
|
|
const { protect, supervisor, optionalAuth } = require('../middleware/authMiddleware');
|
|
const { scopeEvent, scopeList } = require('../utils/campusScope');
|
|
|
|
// Check a code against a basket before registering (guests included)
|
|
router.post('/validate', optionalAuth, scopeEvent({ from: req => req.body?.eventId }), validateCode);
|
|
|
|
router.get('/', protect, supervisor, scopeList, listCoupons);
|
|
router.post('/', protect, supervisor, scopeList, createCoupon);
|
|
router.get('/redemptions', protect, supervisor, scopeList, listRedemptions);
|
|
router.get('/:id', protect, supervisor, scopeList, getCoupon);
|
|
router.put('/:id', protect, supervisor, scopeList, updateCoupon);
|
|
|
|
module.exports = router;
|