Problem
lib/waitlist/slot-handler.ts assigns freed slots outside the booking tx, and multi-session class enrollment can fail mid-loop leaving partial enrollment. No unique constraint on the SlotOfAppointment↔User m:n protects against double-assignment.
Fix shape
Move assignment into the same tx as the slot release (or CAS-claim per slot); add the missing unique constraint at the pre-MVP schema reset; make multi-session enrollment all-or-nothing.
Problem
lib/waitlist/slot-handler.tsassigns freed slots outside the booking tx, and multi-session class enrollment can fail mid-loop leaving partial enrollment. No unique constraint on the SlotOfAppointment↔User m:n protects against double-assignment.Fix shape
Move assignment into the same tx as the slot release (or CAS-claim per slot); add the missing unique constraint at the pre-MVP schema reset; make multi-session enrollment all-or-nothing.