Add multi-day capacity engine and booking flow#1086
Open
stefan-burke wants to merge 2 commits intoduration-days/1-schema-typesfrom
Open
Add multi-day capacity engine and booking flow#1086stefan-burke wants to merge 2 commits intoduration-days/1-schema-typesfrom
stefan-burke wants to merge 2 commits intoduration-days/1-schema-typesfrom
Conversation
Core capacity: - `dateToRange(date, durationDays)`: half-open range spanning N days - `buildDayCapacitySql`: single-day SQL clause for event+group cap - `buildCapacityCondition`: per-day AND'd expansion for multi-day bookings - Per-day JS preflight: `expandDailyRange`, `everyDay`, `aggregateDemand` - `checkEventAvailability`: walks each day checking event+group caps - `checkBatchAvailability`: per-day demand aggregation across batch items - `hasAvailableSpots`: duration-aware wrapper Attendee create/update: - `createAttendeeAtomic`: threads durationDays into INSERT range - `updateEventLink`: duration-aware capacity check + range update - `addEventLink`: passes duration through - `recomputeEventBookingRanges` + `checkGroupCapAfterDurationChange` (internal, exported in next PR when admin UI connects) Booking flow: - `bookingDateFields(event, date)`: shared date+duration extraction - `processBooking`, webhook handler, availability API all pass duration No behavior change in production: all existing events have duration_days=1, so all callers pass 1 through.
…rom PR2 These functions have no callers until the admin UI PR connects them. Keeping them here caused coverage failures (uncovered lines 83-142). They'll be re-added in PR3 alongside their production consumer and tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dateToRange(date, durationDays): half-open range spanning N calendar daysbuildDayCapacitySql+buildCapacityConditionemits AND'd per-day clausesexpandDailyRange,everyDay,aggregateDemand,checkEventAvailability,checkBatchAvailability,hasAvailableSpotsdurationDaysthrough INSERT range and capacity checksbookingDateFields(event, date)shared helper keeps payment + webhook flows alignedrecomputeEventBookingRanges+checkGroupCapAfterDurationChange(internal, exported in PR3)No behavior change in production: all existing events have
duration_days=1, so all callers pass 1 through. The engine is fully tested but not yet activatable via UI.PR Stack
duration-days/1-schema-types— schema + types + date helpersduration-days/3-admin-ui— admin UI + display (depends on this)Test plan
Generated by Claude Code