feat(reservations): service + validators + exclusivity tests
Adds the berth_reservations service covering the full lifecycle
(pending -> active -> ended/cancelled) with tenant scoping, DB-enforced
exclusivity on the idx_br_active partial unique index, and
client-or-company-member cross-checks for yacht ownership.
- validators: createPending / activate / end / cancel / list schemas
- service: createPending, activate, endReservation, cancel, getById,
listReservations — with narrow 23505/idx_br_active catch that
re-queries the conflicting active reservation
- socket events: berth_reservation:{created,activated,ended,cancelled}
- tests: unit (lifecycle, tenant, membership cross-check),
integration (concurrent-activate ConflictError + re-activate after end)
This commit is contained in:
@@ -107,6 +107,12 @@ export interface ServerToClientEvents {
|
||||
clientId: string;
|
||||
}) => void;
|
||||
|
||||
// Berth reservation events
|
||||
'berth_reservation:created': (payload: { reservationId: string; berthId: string }) => void;
|
||||
'berth_reservation:activated': (payload: { reservationId: string; berthId: string }) => void;
|
||||
'berth_reservation:ended': (payload: { reservationId: string; berthId: string }) => void;
|
||||
'berth_reservation:cancelled': (payload: { reservationId: string; berthId: string }) => void;
|
||||
|
||||
// Document events
|
||||
'document:created': (payload: { documentId: string; type?: string; interestId?: string }) => void;
|
||||
'document:updated': (payload: { documentId: string; changedFields?: string[] }) => void;
|
||||
|
||||
Reference in New Issue
Block a user