Slots: bulk tools, get-ready time, group places, and bookings block overlapping slots #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "session/redo-slots-and-add-get-ready-tim"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This reworks how slots are created and booked:
How booking state works now
Nothing about bookings is stored on a slot any more.
slotStates()inpocketbase/pb_hooks/shop/lib.jsis the only place the rules live:basket_lines.heldUntil). An expired hold stops counting immediately; the once-a-minute job only tidies up.GET /api/shop/slotsreturns the bookable future slots to the public shop (full and blocked ones hidden). With?detail=1, a signed-in admin gets every slot in a range with places booked/held and what blocks it.add_slot, now withseats) and changing a group line's places re-check capacity and blocking in the same database transaction that writes the hold. PocketBase runs transactions one at a time, so two customers can't both get the last place or two overlapping times.What changes for the client (admin)
?month=YYYY-MM) with a service filter and a day panel.2/4.What changes for customers
Migrations
1792800000_items_buffer_minutesaddsitems.bufferMinutes.1792800100_slot_capacity_and_line_holds:items.capacityandslots.capacity(existing slots get 1).basket_lines.heldUntil, copied from the slot each line was holding.basket_lines.slotwith a plain one, and indexesorder_lines.slot.slots.status/heldUntil/order. Bookings already live inorder_lines.pb_schema.jsonmirrors both (new fields in the 0.23 format). Rolling back restores the schema, but not old holds or bookings on slots; restore a backup for that. Take a backup before deploying.Tested
svelte-check, admin and public: 0 errors. All warnings were already there.main's schema with an old-style held slot (plus its basket line) and a booked slot (plus a paid order). The hold moved to the basket line, slots got capacity 1, and the indexes, fields and rules all ended up as intended. Fresh install: migrations + importingpb_schema.jsongave the same schema.2× …).Notes for later
pb_schema.jsonnestmin/maxunder"options". PocketBase 0.23 ignores that on fresh installs (noted in the README).docker-compose.ymlpublishes Caddy as a bare8080:8080. The pinnedspectado/pocketbase:0.23.12image can no longer be pulled from Docker Hub.Follow-up fixes from review
renew_holds; holds are extended, never shortened). When a hold runs out, the customer is told which time was removed.en-GB(day-month-year, 24-hour clock) and the studio'sSITE_TIMEZONE, through$shared/calendarhelpers. The server's default locale was en-US. Native date pickers still follow the visitor's browser language.Tested in headless Chromium with an en-US / New York browser, no console errors: jump to January 2027; 1 → 3 places with + disabled at full; back to 0 and the places return; remove on /book, then home shows 3 places left; countdown 10:00; at 1:29 the renew button appears and resets it to 10:00; a 4-second hold ends with the "ran out" message; admin shows "In a basket". Both apps type-check with 0 errors.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
Slots: bulk generate/copy/clear, per-service get-ready time, calendar viewto Slots: bulk tools, get-ready time, group places, and bookings block overlapping slots