Kaizen
Browse modulesBookingsbookings/serverFunctions

Function: assertInsideWindows()

function assertInsideWindows(repos: BookingRepositories, members: readonly ClaimIntent[]): Promise<void>;

Defined in: server/bookings/availability-service.ts:96

The §6.9 write-time containment guard: every member's requested [startsAt, endsAt) must be contained in the MERGED union of live windows for its resource — windows from different series may abut or overlap, so merge-before-containment (two abutting 9–12/12–17 windows admit a 10–14 request). Throws GroupClaimFailedError wrapping per-member OutsideAvailabilityErrors (the claim core unwraps a batch of one).

MUST run inside BookingRepositories.transaction(...), in the same transaction as the §6.6 capacity check. Takes the per-space row lock on the member resources itself — under allowOverbook the capacity check (and its overlap-set lock) is skipped entirely, and this guard must still serialize against window edits. Re-locking rows the capacity check already locked is a no-op for the same transaction.

Parameters

ParameterType
reposBookingRepositories
membersreadonly ClaimIntent[]

Returns

Promise<void>

On this page