Repository navigation
Closed
Labels
Description
Parent
What to build
Add atomic capacity checking to the enrollment flow. When an event is full, participants are placed on a waitlist (FIFO) if the policy allows, otherwise enrollment is rejected.
Modify EnrollUserAction:
- Inside
DB::transaction, uselockForUpdate()on the enrollment policy to prevent race conditions - Count current
confirmed + checked_in + attendedenrollments for the event - If count < capacity (or capacity is null/unlimited): confirm as before
- If count >= capacity AND
has_waitlist = true: create enrollment with statuswaitlisted, assignwaitlist_position(max position + 1) - If count >= capacity AND
has_waitlist = false: throw validation exception (422 "Event is full") - Record appropriate transition in audit trail
Domain event:
- Dispatch
EnrollmentWaitlisted(for future notifications) implementingShouldDispatchAfterCommit
Admin panel:
- Waitlist column visible in enrollments RelationManager
- Filter enrollments by status (confirmed, waitlisted, etc.)
App panel:
- Show "You are on the waitlist (position X)" when status is
waitlisted - Show "Event is full" message when capacity reached and no waitlist
Scopes on EventEnrollment model:
scopeConfirmed(),scopeWaitlisted(),scopeActive()(confirmed + checked_in + attended)
Acceptance criteria
- Enrollment respects capacity limit — no overbooking under concurrent requests
- Waitlisted enrollment gets correct
waitlist_position(FIFO) - Event without waitlist returns 422 when full
- Event with unlimited capacity (null) always confirms
-
lockForUpdate()is used inside transaction for atomicity - Admin panel shows waitlist status and position
- App panel shows waitlist position to participant
- Feature tests: capacity enforcement, waitlist assignment, concurrent enrollment simulation, unlimited capacity
- Pint passes
Blocked by
- feat(events): RSVP enrollment end-to-end #240 (RSVP Enrollment)
Activity
[-]Events: Waitlist + Capacity enforcement[/-][+]feat(events): waitlist and capacity enforcement[/+]feat(events): waitlist and capacity enforcement (#294)
feat(events): waitlist and capacity enforcement (#294)
feat: events module (#309)