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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user