fix(appointment): mark past-time slots as unavailable

is_available only checked whether a slot was booked, so on today's date
slots whose start time had already passed (e.g. 10:00 when it is 12:00)
still showed as bookable until the POST /appointment 422. Treat a slot
with start < now as unavailable in getAllSlotsWithAvailability, and drop
past slots in filterBookedSlots so getAvailableSlots agrees. Future days
are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 16:48:50 +03:30
co-authored by Claude Opus 4.8
parent c662eb9b4f
commit 4216e67d68
3 changed files with 123 additions and 3 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ Get all appointment slots (available and booked) for a doctor on a specific date
}
```
> Returns **all** slots grouped by work shift. `is_available: false` means the slot has an active (pending/confirmed) appointment. Session boundaries match the doctor's `WeeklySchedule` or date override config.
> Returns **all** slots grouped by work shift. `is_available: false` means the slot is either already booked (active pending/confirmed appointment) **or** its start time has already passed (for today's date). Session boundaries match the doctor's `WeeklySchedule` or date override config.
### Errors
| Code | HTTP | Description |