Events can take a name (and optional email/phone) for each main-ticket place. Each named person gets their own quantity-1 ticket and attendee form; unnamed places share one ticket. Tickets go to the payer or to each person, attendees matching one existing account are linked to it, and the payer can edit names and send form links from My Events. Ticket generation is now planned per line (utils/attendees.js), free registrations use the same generator, and guest registration matches accounts by phone too, refusing conflicting email/phone pairs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.9 KiB
JavaScript
45 lines
1.9 KiB
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const {
|
|
createRegistration,
|
|
getRegistrations,
|
|
getUserRegistrations,
|
|
getRegistrationById,
|
|
updateRegistrationStatus,
|
|
cancelRegistration,
|
|
getRegistrationsByEvent,
|
|
createManualRegistration,
|
|
updateRegistrationOptions,
|
|
submitFormResponses, replaceFormResponses,
|
|
getFormDraft, saveFormDraft,
|
|
sendInvoice,
|
|
applyCoupon, removeCoupon,
|
|
updateAttendees, sendAttendeeFormLink,
|
|
} = require('../controllers/registrationController');
|
|
const { protect, supervisor, staff, optionalAuth } = require('../middleware/authMiddleware');
|
|
|
|
// Registration - auth optional when event doesn't require it
|
|
router.post('/', optionalAuth, createRegistration);
|
|
router.get('/myregistrations', protect, getUserRegistrations);
|
|
router.put('/:id/options', protect, updateRegistrationOptions);
|
|
router.delete('/:id', protect, cancelRegistration);
|
|
router.post('/:id/send-invoice', protect, sendInvoice);
|
|
router.post('/:id/coupon', protect, applyCoupon);
|
|
router.delete('/:id/coupon', protect, staff, removeCoupon);
|
|
router.put('/:id/attendees', protect, updateAttendees);
|
|
router.post('/:id/attendees/:attendeeId/send-form-link', protect, sendAttendeeFormLink);
|
|
|
|
// Registration detail + forms — optionalAuth so guests can access with just the registrationId
|
|
router.get('/:id', optionalAuth, getRegistrationById);
|
|
router.get('/:id/forms/draft', optionalAuth, getFormDraft);
|
|
router.put('/:id/forms/draft', optionalAuth, saveFormDraft);
|
|
router.post('/:id/forms/responses', optionalAuth, submitFormResponses);
|
|
router.put('/:id/forms/responses', protect, supervisor, replaceFormResponses);
|
|
|
|
// Admin/Staff routes
|
|
router.get('/', protect, staff, getRegistrations);
|
|
router.put('/:id', protect, staff, updateRegistrationStatus);
|
|
router.get('/event/:eventId', protect, staff, getRegistrationsByEvent);
|
|
router.post('/manual', protect, supervisor, createManualRegistration);
|
|
|
|
module.exports = router; |