refactor: remove auto deposit penalty on no-shows, add comprehensive tests
- Remove automatic deposits_required=3 on no-shows, give admin flexibility - Add tests for no-show deposit logic (forgiven, over 24h, under 24h) - Add tests for reservation cleanup TTL (admin walk-in/call-in 15min) - Add tests for EXIF GPS data stripping in portfolio images - Add tests for contact info endpoint - Add tests for guest account anonymization
This commit is contained in:
@@ -1869,17 +1869,12 @@ func DeleteBookingHandler(w http.ResponseWriter, r *http.Request) {
|
||||
tx.QueryRow(r.Context(), "SELECT start_time FROM bookings WHERE id = $1", bookingID).Scan(&startTime)
|
||||
noticeHours := startTime.Sub(time.Now()).Hours()
|
||||
|
||||
// < 24 hours notice: treat as no-show
|
||||
if noticeHours < 24 {
|
||||
// Check if admin is forgiving this no-show
|
||||
isForgiving := req.ForgiveNoShow != nil && *req.ForgiveNoShow
|
||||
|
||||
if !isForgiving {
|
||||
// No forgiveness: apply penalty
|
||||
tx.Exec(r.Context(), "UPDATE users SET deposits_required = 3 WHERE id = $1", userID)
|
||||
tx.Exec(r.Context(), "UPDATE bookings SET status = 'no_show' WHERE id = $1", bookingID)
|
||||
} else {
|
||||
// Forgiveness granted: treat as client_cancelled, no penalty
|
||||
tx.Exec(r.Context(), "UPDATE bookings SET status = 'client_cancelled' WHERE id = $1", bookingID)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user