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.
This commit is contained in:
2026-08-22 00:34:49 +01:00
parent 503449b0bc
commit c80ad467e7
+6
View File
@@ -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) http.Error(w, "Cannot approve: the proposed time falls during a period when the salon is closed", http.StatusConflict)
return 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 // Build update query for bookings table