Booking model docs, per-ticket prices, and booking/order id validation - #13
Merged
Conversation
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>
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.
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. Coversbooking.ts(the ~60-fieldBooking,Guest,Ticket, etc.),booking-payment.ts,booking-addon.ts, andavailability-time.ts. Field semantics were drawn from the converters (local-vs-UTC datetime pairs,source/sourceApp/sourceDescription, fallback values,includeGuests/includePriceBreakdowngating). Comments only — no behavior change.2. Per-ticket list price + total (
f8839e2)When
includePriceBreakdownis requested, the bookings query now selects avalue { price, total }block insideticketQuantities, and the converter maps it onto two new optionalTicketfields:listPriceandtotalValue. 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 prefixedb, orderso. Mixed forms (B_abc123,o-Ab123), a missing prefix, or the wrong resource's id are rejected. Wired into all id-takingBookingServicemethods pluscreate'sparentOrderId. Also renames the non-canonical mock ids (bkg_*/ord-*) in the booking/membership tests to the single-letter form the API documents.Verification
tsc --noEmitclean,eslintclean.ARCHITECTURE.mdupdated for the new validation; no version bump.🤖 Generated with Claude Code