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:
@@ -1,5 +1,5 @@
|
||||
# Crussell
|
||||
#KM|> **Last Updated:** May 2026 — Test infrastructure overhaul, 286/288 tests passing
|
||||
#KM|> **Last Updated:** May 2026 — Booking edit modal for /today page, 306/308 tests passing
|
||||
Crussell is a **full‑stack application** that powers a nail‑bar / salon booking service. The repository is split into a **Go** backend and a **SvelteKit** front‑end, both of which are containerised with Docker. A lightweight **SabreDAV** instance is also exposed so that the salon can offer WebDAV access to clients.
|
||||
|
||||
## 📦 Project Structure
|
||||
@@ -158,7 +158,7 @@ go test -tags test ./...
|
||||
|
||||
### Test Coverage
|
||||
|
||||
**286/288 tests passing** across all handler packages. Coverage includes guest user creation, guest bookings, slot reservation lifecycle, time blockers, anonymization, booking CRUD, admin management, authentication, scheduling, notifications, portfolio, user profiles, deposit system, edit requests, and discount campaigns.
|
||||
**306/308 tests passing** across all handler packages. Coverage includes guest user creation, guest bookings, slot reservation lifecycle, time blockers, anonymization, booking CRUD, admin management, authentication, scheduling, notifications, portfolio, user profiles, deposit system, edit requests, discount campaigns, and **booking service editing**.
|
||||
|
||||
## 📂 Environment Variables
|
||||
|
||||
@@ -204,7 +204,7 @@ The `local-dev-2.sh` script automatically seeds:
|
||||
| Booking CRUD | ✅ | ✅ | Full guest + authenticated booking flow with 5-step wizard |
|
||||
| Guest Booking System | ✅ | ✅ | `POST /api/users/guest` creates disposable accounts; email uniqueness enforced for registered users only |
|
||||
| Slot Reservation | ✅ | ✅ | `POST /api/bookings/reserve` (public) + admin endpoints; 4 TTL types (user:1h, anon:10min, walkin:5min, callin:1h); 50-cap for anon |
|
||||
| Admin Endpoints | ✅ | ✅ | Services, users, today view, notifications, bookings |
|
||||
| Admin Endpoints | ✅ | ✅ | Services, users, today view, notifications, bookings, **booking service editing** |
|
||||
| Scheduling System | ✅ | ✅ | Default hours, exceptional hours, working/available hours, time blockers |
|
||||
| Holiday Hours | ✅ | ✅ | Integrated in all 3 booking flows |
|
||||
| Loyalty Backend | ✅ | ✅ | DB schema + displayed in account page |
|
||||
@@ -270,6 +270,7 @@ Crussell supports **three distinct booking flows**:
|
||||
| Self-Service | Customer | `BookingFlow.svelte` → reserve slot → guest account (if needed) → `POST /api/bookings` | ✅ |
|
||||
| Walk-In | Admin | Admin panel → walk-in modal → reserve (5min TTL) → create booking | ✅ |
|
||||
| Call/Message-In | Admin | Admin panel → booking modal → reserve (60min TTL) → create booking | ✅ |
|
||||
| **Booking Edit** | Admin | `/today` → Next Appointment → Edit → `PUT /api/admin/bookings/{id}` | ✅ |
|
||||
|
||||
All three flows integrate with the **holiday/exceptional hours** system and **time blockers** to prevent bookings during closed or blocked periods.
|
||||
|
||||
|
||||
@@ -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) ✅
|
||||
|
||||
Reference in New Issue
Block a user