feat(appointment): enhance booking window functionality with day/week/month options and update defaults
This commit is contained in:
@@ -140,11 +140,11 @@ Create or update the weekly schedule for a doctor (upsert).
|
||||
|-------|------|----------|-------------|
|
||||
| `online_booking_enabled` | boolean | ❌ | `false` = no online booking; the public slot/month endpoints return no availability |
|
||||
| `booking_window_value` | integer | ❌ | How far ahead patients may book (≥ 1) |
|
||||
| `booking_window_unit` | string | ❌ | `"week"` or `"month"` |
|
||||
| `booking_window_unit` | string | ❌ | `"day"`, `"week"` or `"month"` (invalid value keeps the current one) |
|
||||
| `booking_mode` | string | ❌ | `"slot"` (پیشفرض) = نوبتدهی اسلاتی با مدت ثابت (`duration_per_patient`). `"service"` = مدت هر نوبت از `duration_minutes` سرویسِ انتخابشده؛ زمانها با `GET /api/v1/appointment-service-slots` گرفته میشوند. مقدار نامعتبر نادیده گرفته میشود |
|
||||
| `buffer_minutes` | integer | ❌ | فقط حالت سرویسی: فاصلهٔ بین نوبتها (دقیقه، ≥ 0). در `slot_end` ذخیره نمیشود؛ فقط فاصلهٔ بین زمانهای پیشنهادی |
|
||||
|
||||
> Defaults when `meta` is absent: `{ online_booking_enabled: true, booking_window_value: 1, booking_window_unit: "month", booking_mode: "slot", buffer_minutes: 0 }`. `meta` is stored inside the schedule `setting` JSON (no DB migration) and is **preserved** when only `schedule` is sent. `SlotCalculatorService` rejects any date in the past, beyond `today + value unit`, or when online booking is disabled — for the weekly schedule, date overrides, and `appointment-slots` alike.
|
||||
> Defaults when `meta` is absent: `{ online_booking_enabled: true, booking_window_value: 3, booking_window_unit: "month", booking_mode: "slot", buffer_minutes: 0 }`. `meta` is stored inside the schedule `setting` JSON (no DB migration) and is **preserved** when only `schedule` is sent. `SlotCalculatorService` rejects any date in the past, beyond `today + value unit`, or when online booking is disabled — for the weekly schedule, date overrides, and `appointment-slots` alike.
|
||||
>
|
||||
> **اجبار حالت سرویسی:** اگر `booking_mode = service` ذخیره شود ولی پزشک هیچ سرویسِ «نمایش در نوبتدهی» (`bookable = true`) نداشته باشد، `POST`/`PATCH` برنامهٔ هفتگی با `422` (`ERR_VALIDATION_001`, field `booking_mode`) رد میشود.
|
||||
>
|
||||
@@ -185,7 +185,7 @@ Create or update the weekly schedule for a doctor (upsert).
|
||||
},
|
||||
"meta": {
|
||||
"online_booking_enabled": true,
|
||||
"booking_window_value": 1,
|
||||
"booking_window_value": 3,
|
||||
"booking_window_unit": "month",
|
||||
"booking_mode": "slot",
|
||||
"buffer_minutes": 0
|
||||
|
||||
@@ -170,7 +170,7 @@ Which days of a month are bookable — used by the public calendar to grey out u
|
||||
"disabled_dates": ["2026-06-01", "2026-06-17", "2026-06-26"],
|
||||
"enabled_dates": ["2026-06-15", "2026-06-16", "2026-06-18"],
|
||||
"online_booking_enabled": true,
|
||||
"booking_window": { "value": 1, "unit": "month" }
|
||||
"booking_window": { "value": 3, "unit": "month" }
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -180,7 +180,7 @@ Which days of a month are bookable — used by the public calendar to grey out u
|
||||
| `disabled_dates` | string[] | `Y-m-d` days with no bookable slot (holiday / closed override / non-working / past / out-of-window) |
|
||||
| `enabled_dates` | string[] | `Y-m-d` days with at least one slot |
|
||||
| `online_booking_enabled` | boolean | Doctor's online-booking flag |
|
||||
| `booking_window` | object | `{ value, unit }` — `unit` is `week` or `month` |
|
||||
| `booking_window` | object | `{ value, unit }` — `unit` is `day`, `week` or `month` (default `3 month`) |
|
||||
|
||||
### Errors
|
||||
| Code | HTTP | Description |
|
||||
|
||||
Reference in New Issue
Block a user