Skip to content

Add duration_days column, types, and multi-day date helpers#1085

Open
stefan-burke wants to merge 2 commits intomainfrom
duration-days/1-schema-types
Open

Add duration_days column, types, and multi-day date helpers#1085
stefan-burke wants to merge 2 commits intomainfrom
duration-days/1-schema-types

Conversation

@stefan-burke
Copy link
Copy Markdown
Member

Summary

  • Add duration_days INTEGER NOT NULL DEFAULT 1 to events table
  • Add duration_days to Event interface, EventInput, and type definitions
  • Add durationDays? to EventBooking, BatchAvailabilityItem, UpdateEventLinkInput
  • Add isRangeBookable helper: validates every day in a multi-day range is bookable
  • Update getAvailableDates/getNextBookableDate to respect duration (excludes start dates whose full range would hit non-bookable days or extend past window)

Zero behavior change: all existing events have duration_days=1, which preserves single-day semantics throughout.

PR Stack

  1. This PR — schema + types + date helpers
  2. duration-days/2-backend-engine — capacity engine + booking flow (depends on this)
  3. duration-days/3-admin-ui — admin UI + display (depends on Update bunny deploy script for build:edge #2)

Test plan

  • Typecheck passes
  • Lint clean (546 files)
  • Full test suite passes (324 files, 5974 steps, 0 failures)
  • New tests in test/lib/dates.test.ts cover multi-day range exclusion

Generated by Claude Code

claude added 2 commits May 5, 2026 02:01
Schema & types:
- Add `duration_days INTEGER NOT NULL DEFAULT 1` to events table
- Add `duration_days` to Event interface, EventInput, EventWithCount
- Add `durationDays?` to EventBooking, BatchAvailabilityItem, UpdateEventLinkInput
- Update testEvent factory and API example with the new field

Date helpers:
- Add `isRangeBookable`: checks every day in a multi-day range is bookable
- Update `getAvailableDates`/`getNextBookableDate` to respect duration_days
  (excludes start dates whose full range would hit non-bookable days)

Zero behavior change: all existing events have duration_days=1, which
preserves single-day semantics throughout.
The schema hash auto-detects the column addition, but the human-readable
version string should describe the latest structural change for debugging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants