feat(appointment): enforce mandatory patient national code and gender with validation
This commit is contained in:
@@ -133,7 +133,7 @@ Book an appointment slot.
|
||||
"patient_name": "علی احمدی",
|
||||
"patient_mobile": "09120000000",
|
||||
"patient_national_code": "0012345678",
|
||||
"patient_gender": "male",
|
||||
"patient_gender": "man",
|
||||
"patient_reason": "چکاپ",
|
||||
"note": "لطفاً سریع ویزیت شوم"
|
||||
}
|
||||
@@ -147,8 +147,8 @@ Book an appointment slot.
|
||||
| `for_self` | boolean | ❌ | `true` (default) = patient is the logged-in payer; `false` = booking for someone else |
|
||||
| `patient_name` | string | ⚠️ | Required when `for_self=false`; otherwise filled from the payer's profile |
|
||||
| `patient_mobile` | string | ⚠️ | Required when `for_self=false`; otherwise the payer's mobile |
|
||||
| `patient_national_code` | string | ❌ | Patient national code (only when for another person) |
|
||||
| `patient_gender` | string | ❌ | `male` / `female` |
|
||||
| `patient_national_code` | string | ✅ | کد ملی بیمار — **همیشه الزامی** (هر دو حالت `for_self`). باید ۱۰ رقم معتبر باشد (`isValidIranNationalCode`)؛ ارقام فارسی به انگلیسی تبدیل میشوند |
|
||||
| `patient_gender` | string | ✅ | جنسیت بیمار — **همیشه الزامی**. ورودی `man`/`male` یا `woman`/`female` پذیرفته میشود و به فرمِ متعارف `man`/`woman` ذخیره میگردد |
|
||||
| `patient_reason` | string | ❌ | Reason for visit |
|
||||
| `note` | string | ❌ | Patient note |
|
||||
|
||||
@@ -174,7 +174,7 @@ Book an appointment slot.
|
||||
"patient_name": "علی احمدی",
|
||||
"patient_mobile": "09120000000",
|
||||
"patient_national_code": "0012345678",
|
||||
"patient_gender": "male",
|
||||
"patient_gender": "man",
|
||||
"patient_reason": "چکاپ",
|
||||
"version": 1,
|
||||
"created_at": 1717000000
|
||||
@@ -197,7 +197,7 @@ Book an appointment slot.
|
||||
| `ERR_AUTH_001` | 401 | Missing token |
|
||||
| `ERR_VALIDATION_002` | 404 | Doctor not found |
|
||||
| `ERR_CONFLICT_001` | 409 | Slot already booked (incl. concurrent booking — the booking is atomic) |
|
||||
| `ERR_VALIDATION_001` | 422 | Invalid slot times, past slot, or missing patient name/mobile when `for_self=false` |
|
||||
| `ERR_VALIDATION_001` | 422 | Invalid slot times, past slot, missing patient name/mobile when `for_self=false`, missing/invalid `patient_national_code`, or `patient_gender` not in `man`/`male`/`woman`/`female` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user