Skip to content

Booking model docs, per-ticket prices, and booking/order id validation - #13

Merged
oskarbruening merged 4 commits into
mainfrom
docs/model-tsdoc
Jul 13, 2026
Merged

Booking model docs, per-ticket prices, and booking/order id validation#13
oskarbruening merged 4 commits into
mainfrom
docs/model-tsdoc

Conversation

@oskarbruening

Copy link
Copy Markdown
Collaborator

Three related improvements to the booking/model surface, stacked on one branch.

1. Document the data models (02e790a)

Brings the under-documented models up to the standard set by product.ts — a file-level doc plus a meaningful TSDoc comment on every interface and field. Covers booking.ts (the ~60-field Booking, Guest, Ticket, etc.), booking-payment.ts, booking-addon.ts, and availability-time.ts. Field semantics were drawn from the converters (local-vs-UTC datetime pairs, source/sourceApp/sourceDescription, fallback values, includeGuests/includePriceBreakdown gating). Comments only — no behavior change.

2. Per-ticket list price + total (f8839e2)

When includePriceBreakdown is requested, the bookings query now selects a value { price, total } block inside ticketQuantities, and the converter maps it onto two new optional Ticket fields: listPrice and totalValue. Both stay absent when the breakdown is not requested, mirroring the existing booking-level breakdown fields. Scoped to the read path — the external webhook query is intentionally unchanged.

3. Booking/order id format validation (2269a31)

Every booking/order id accepted as a parameter is format-checked before normalization. Valid forms: lowercase db id with _ (b_abc123 / o_abc123) or uppercase display id with - (B-ABC123 / O-ABC123) — bookings prefixed b, orders o. Mixed forms (B_abc123, o-Ab123), a missing prefix, or the wrong resource's id are rejected. Wired into all id-taking BookingService methods plus create's parentOrderId. Also renames the non-canonical mock ids (bkg_*/ord-*) in the booking/membership tests to the single-letter form the API documents.

Verification

  • tsc --noEmit clean, eslint clean.
  • Full suite: 631 passed (40 files).
  • Coverage: 99.65% statements / 97.11% branches / 100% functions / 99.85% lines — above the 95% gate.
  • ARCHITECTURE.md updated for the new validation; no version bump.

🤖 Generated with Claude Code

oskarbruening and others added 4 commits July 13, 2026 12:31
Bring the under-documented data models up to the standard set by
product.ts: a file-level doc plus a meaningful TSDoc comment on every
interface and field. Field descriptions are drawn from the converters
(source/sourceApp/sourceDescription distinction, local-vs-UTC datetime
pairs, fallback values, includeGuests/includePriceBreakdown gating).

Comments only — no behavior, public surface, or coverage change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When includePriceBreakdown is requested, the bookings query now selects a
`value { price, total }` block inside `ticketQuantities`, and the converter
maps it onto two new optional Ticket fields, listPrice and totalValue. Both
stay absent when the breakdown is not requested, mirroring the existing
booking-level breakdown fields.

Scoped to the read path: the maximal webhook query (an external cross-system
contract) is intentionally left unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Every booking/order id accepted as a parameter is now format-checked
before normalization by assertBookingId/assertOrderId. An id is valid
only as a lowercase db id with `_` (b_abc123 / o_abc123) or an uppercase
display id with `-` (B-ABC123 / O-ABC123) — bookings prefixed `b`,
orders `o`. Mixed forms (B_abc123, o-Ab123), a missing prefix, or the
wrong resource's id are rejected. Checking pre-normalization is
deliberate: normalizeBookingId would erase the case/separator
distinction the check relies on.

Wired into getById, getGuests, getPaymentsOnFile, appendNote,
setCheckinStatus, cancel, makePayment, refund, createInvoiceLink,
listAddons, addAddon, removeAddon, and create's parentOrderId. Also
renames the non-canonical mock ids (bkg_*/ord-*) in the booking and
membership tests to the single-letter form the API documents.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oskarbruening
oskarbruening merged commit 3394610 into main Jul 13, 2026
2 checks passed
@oskarbruening
oskarbruening deleted the docs/model-tsdoc branch July 13, 2026 17:45
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.

1 participant