feat: enriched edit request system with side-by-side snapshots, calendar preloading, and admin review UI
Backend: - Add enriched response types (EditSnapshot, EnrichedEditRequest) with original vs proposed snapshots - Add 4 new GET endpoints for viewing edit requests (user and admin scoped) - Remove github.com/lib/pq dependency — use native PostgreSQL array scanning - Clean up edit requests, time blockers, and notifications on booking cancellation - Validate exceptional closed hours on admin approve (409 Conflict) - Notification upsert on edit request replace (no duplicate admin notifications) Frontend: - New user EditRequestModal with time/services/both modes and lunch protection - New admin EditRequestModal with side-by-side diff (date/time, services, notes) - Integrate edit requests into PendingApprovals card and notifications page - Preload 3 months of availability to prevent calendar snap-back - Apply lunch protection to isDateUnavailable in BookingFlow and BookingCreateModal - Fix accessibility: card list items use <button> instead of <div> Dev & Docs: - Seed edit requests in local-dev-2.sh - Update all Obsidian manuals with enriched edit request documentation - 42 new tests (438/441 passing)
This commit is contained in:
@@ -35,7 +35,6 @@ import (
|
||||
"crussell/testutils/fixtures"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
// =============================================================================
|
||||
@@ -1511,7 +1510,7 @@ func TestAdminBookings_ListEditRequests(t *testing.T) {
|
||||
INSERT INTO booking_edit_requests (booking_id, requested_by, new_start_time, new_services, notes, has_overrides)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)`,
|
||||
bookingID, userID, time.Now().Add(time.Duration(i)*24*time.Hour),
|
||||
pq.Array(&emptyServices), fmt.Sprintf("Edit request %d", i), false)
|
||||
emptyServices, fmt.Sprintf("Edit request %d", i), false)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create edit request %d: %v", i, err)
|
||||
}
|
||||
@@ -1714,7 +1713,7 @@ func TestAdminBookings_ApproveEditRequest(t *testing.T) {
|
||||
`INSERT INTO booking_edit_requests (booking_id, requested_by, new_start_time, new_services, notes)
|
||||
VALUES ($1, $2, $3, $4, 'Please change time')
|
||||
RETURNING id`,
|
||||
bookingID, userID, newStartTime, pq.Array(&emptyServices)).Scan(&editRequestID)
|
||||
bookingID, userID, newStartTime, emptyServices).Scan(&editRequestID)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create edit request: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user