Repository navigation
fix(bookings): store the flow type on a quick-book booking - #546
Conversation
|
Deployment failed for project frontend-templates with the following error: Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit |
|
The fix is correct for quick-book and the other untyped I ran the 1. No test covers the
|
The home page desk tile created a booking whose `booking_type` was a single space, stored by staff-api as an empty string. `Booking` defaults a missing type to `' '`, and `postForm` only fell back to the flow's type when the model's type was falsy. An untyped booking is invisible to the desk list and is skipped by the clash check, so the desk could be booked twice.
newForm now gives an untyped form the flow type. Validators that depend on the type (parking plate number, visitor email) now run for quick-book. postForm sets the type before validation, not after. isCrossTypeEdit no longer treats the blank ' ' type as a real type, so an untyped booking opened for editing is updated, not duplicated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
loadForm(type) now gives an untyped stored booking the flow type. Before, the desk and parking flows saw a type mismatch and replaced the booking with a new form, so a save made a duplicate. BookingFormValue.booking_type is now BookingType, not any. knownBookingType returns a type without the blank ' ' placeholder. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
34cf6bf to
0797407
Compare
What was broken
The home page desk tile (
app.show_quick_book) created a booking whosebooking_typewas a single space, which staff-api stored as"":{"booking_type":"","asset_id":"e2e-desk-0","title":"Booking", ...}Bookingdefaults a missing type to' ', andpostFormonly fell back to the flow's type when the model's type was falsy. A space is truthy, so the fallback never ran. An untyped booking is invisible to the desk listing and is skipped by staff-api's clash check, so the desk can be double-booked.Found by the #497 e2e spec HOME-09, which asserts on the stored
booking_type.Change
newFormsets the flow type on an untyped form. Quick-book and any other caller that does not set the type now get a typed form, and validators that depend on the type (parking plate number, visitor email) run.loadForm(type)sets the flow type on an untyped stored booking. Before, the desk and parking flows saw a type mismatch and replaced the booking with a new form.postFormsets the type before validation, not after.isCrossTypeEdittreats' 'as no type. Before, an untyped booking (as made by this bug) was discarded when opened for editing, and saving made a duplicate._formBookingType()helper replaces the two different blank-type checks.BookingFormValue.booking_typeisBookingType, notany.knownBookingTypereturns a type without the blank' '.Unit tests cover the desk type, parking validation, an untyped
postForm, an untypedloadForm, and the untyped edit. Each newpostForm/loadFormtest fails without its fix.HOME-09 passed against the first commit. I did not run it again on the final head: the e2e Docker stack was not available.
Changes by Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code