From c80ad467e797cd16f52489f2b8c2b409fd033e1d Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Thu, 30 Jul 2026 09:50:30 +0100 Subject: [PATCH] fix: add staged hours check to edit request approval AdminApproveEditRequestHandler checked exceptional hours but not staged default hours changes. Added getClosingTimeForDate check for the proposed reschedule time, matching the pattern used in AdminRescheduleBookingHandler. --- backend/handlers/bookings/manage.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/handlers/bookings/manage.go b/backend/handlers/bookings/manage.go index df3d5d4..91774dd 100644 --- a/backend/handlers/bookings/manage.go +++ b/backend/handlers/bookings/manage.go @@ -1957,6 +1957,12 @@ func AdminApproveEditRequestHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, "Cannot approve: the proposed time falls during a period when the salon is closed", http.StatusConflict) return } + + // Also check the day isn't closed under a staged default hours change + if closeStr, err := getClosingTimeForDate(r.Context(), tx, weekday, localStart); err == nil && (closeStr == "00:00" || closeStr == "00:00:00") { + http.Error(w, "This day will be closed under the upcoming schedule change", http.StatusConflict) + return + } } // Build update query for bookings table