docs: update README, Obsidian docs, and gap backlog for booking edit modal

Reflect new PUT /api/admin/bookings/{id} services endpoint, EditBookingModal
component, and updated test count (306/308). Mark handleEdit() stub resolved
in gap backlog.
This commit is contained in:
2026-05-16 17:32:32 +01:00
parent 80621e0d77
commit a4ea994c69
3 changed files with 19 additions and 9 deletions
+12 -3
View File
@@ -1,4 +1,4 @@
**Last Updated:** May 2026 — Test infrastructure overhaul, 286/288 tests passing
**Last Updated:** May 2026 — Booking edit modal for /today page, 306/308 tests passing
> **Status:** Work in Progress
---
@@ -60,6 +60,10 @@
- Checks for overlapping bookings
- Allows exceptional hours (with warning)
- Clears pending edit requests on edit
- [x] **Admin edit booking services** - PUT `/api/admin/bookings/{id}` (services endpoint) to replace services, apply price/duration overrides, and update notes
- Validates service IDs, overlap with next booking, rejected statuses
- Transactional: deletes old services, inserts new with overrides
- Admin-only, accessed from `/today` → Next Appointment → Edit button
- [x] **In-progress auto-infer** - Status auto-sets based on time (confirmed → in_progress → completed)
- [x] **Auto-complete** - Bookings auto-complete when duration elapses
- [x] **Slot reservation system** - `POST /api/bookings/reserve` (public, OptionalAuth), `POST /api/admin/bookings/reserve` (admin)
@@ -125,7 +129,7 @@
- [ ] **Guest user endpoint** - ✅ DONE: `POST /api/users/guest` creates disposable accounts, partial unique email index
#### Unit Tests & CI/CD
- [x] 286/288 tests passing across all handler packages
- [x] 306/308 tests passing across all handler packages
- [x] TestMain per package — schema migration runs once per package (not per test)
- [x] TruncateTables() between tests — TRUNCATE CASCADE, ~60% faster than DROP+CREATE
- [x] Test output streamed in real-time via `tee` in local-dev-2.sh
@@ -275,6 +279,9 @@ go test -v -run "TestBooking" ./...
### Recent Testing Updates (May 2026)
**Booking Edit Modal + Endpoint Tests:**
- **`PUT /api/admin/bookings/{id}`** — New endpoint for replacing booking services with overlap detection, status validation, and transactional updates. 20 new tests covering success paths (replace/add/remove services, price/duration overrides, notes), validation errors (invalid IDs, empty services, negative price, zero duration), status rejections (completed/cancelled/no_show), overlap detection, response shape, and edge cases (pending/in_progress bookings).
**Major Test Infrastructure Overhaul:**
- **TestMain per package** — Schema migration (DROP+CREATE) now runs once per package instead of once per test. 10 package-level TestMain functions across 10 test packages.
- **Truncate-only between tests** — Per-test setup changed from full schema rebuild to `TRUNCATE TABLE ... CASCADE` only. ~60% reduction in test DB setup time.
@@ -284,7 +291,7 @@ go test -v -run "TestBooking" ./...
- **Flaky test fixes** — `TestAdminReserveSlot_WalkIn_Success` and `TestAdminReserveSlot_ReplacesExisting` used `time.Now()` which could fall after working hours. Fixed to use noon tomorrow.
- **local-dev-2.sh** — Test output now streamed in real-time via `tee` instead of captured silently.
**Test Coverage: 286/288 passing** (was 222/224)
**Test Coverage: 306/308 passing** (was 286/288)
---
@@ -390,6 +397,7 @@ flowchart TD
| GET | `/api/admin/bookings/search` | Search bookings |
| GET | `/api/admin/bookings/user/{user_id}` | User's bookings |
| PUT | `/api/admin/bookings/{id}/progress` | Progress status |
| PUT | `/api/admin/bookings/{id}` | Update booking services, overrides, and notes |
| POST | `/api/admin/bookings/{id}/confirm` | Confirm booking |
| POST | `/api/admin/bookings/{id}/cancel` | Cancel booking |
| POST | `/api/admin/bookings/reserve` | Reserve slot for admin booking (walkin=5min TTL, callin=1h TTL) |
@@ -614,6 +622,7 @@ src/lib/components/
│ ├── BookingModal.svelte
│ ├── BookingsCard.svelte
│ ├── CallInBooking.svelte
│ ├── EditBookingModal.svelte
│ ├── HolidayHours.svelte
│ ├── ImageUpload.svelte
│ ├── PatchTestModal.svelte
@@ -1,4 +1,4 @@
**Last Updated:** May 2026 — Test infrastructure overhaul complete (#51)
**Last Updated:** May 2026 — Booking edit modal for /today page, 306/308 tests passing
**Status:** Living backlog — add to this as gaps are discovered
---
@@ -14,7 +14,7 @@ No external dependencies. No paid services. No API keys needed.
| 1 | ~~`DELETE /api/user/account` is a no-op~~ ✅ | S (1-2h) | Backend | Wired to `anonymize_user()` for registered users and `delete_guest_user()` for guests. CardDAV contact deleted best-effort. |
| 2 | ~~**WalkInCreateModal guest booking errors out**~~ ✅ | S (1-2h) | Frontend | Guest creation now fires at submit time in both walk-in and call-in flows. Phone defaults to +447700900000 if left blank. |
| 3 | ~~**ApprovalModal decline/cancel stub**~~ ✅ | S (2-3h) | Frontend | `handleDecline()` now calls `POST /api/admin/bookings/{id}/cancel`. Backend sets status to `we_cancelled`, acknowledges pending notification, creates cancelled_booking notification. |
| 4 | **CurrentAppointment action stubs** | M (1d) | Frontend | `handleTakePayment()` ⚠️ blocked on Square. `handleExtend()`, `handleCancel()` — dead buttons. |
| 4 | **CurrentAppointment action stubs** | M (1d) | Frontend | `handleEdit()` ✅ — now opens `EditBookingModal` for service management. `handleTakePayment()` ⚠️ blocked on Square. `handleExtend()`, `handleCancel()` — dead buttons. |
## P1 — High
@@ -180,7 +180,7 @@ Require paid accounts, API approval, or external service credentials. **Do not a
9. **#2** Wire WalkInCreateModal guest booking (1-2h) ✅
10. **#3** ApprovalModal decline/cancel (2-3h) ✅
11. **#5** Admin notification panel (1-2d)
12. **#4** CurrentAppointment Extend + Cancel actions (1d) — skip TakePayment (blocked on E1)
12. **#4** CurrentAppointment Extend + Cancel actions (1d) — skip TakePayment (blocked on E1). **Edit** ✅ — now opens `EditBookingModal` for service management.
13. **#12** Booking cancellation from user account (2-3h)
14. **#40** No-show tracking dashboard (2-3h)
15. **#35** Walk-in slot blocking (1-2h) ✅