- Fix national code handling in staff creation and updates to support Persian digits. - Update ClinicStaff entity to allow longer national codes (up to 15 characters). - Implement support for clinic secretaries in SecretaryController, allowing creation without a doctor UUID. - Add a new endpoint to retrieve doctors associated with a clinic for secretary management. - Improve appointment management by ensuring doctors are selectable even when no appointments exist. - Extend PatientController to allow secretaries to create patient records if they have the appropriate permissions. - Introduce a PriceInput component for better price formatting in forms, supporting Persian digits. - Add a MockGateway for testing payment processes without real transactions. - Enhance SMS settings management with an approval flow for post-visit text messages, including new fields for pending text and status. - Update migrations to reflect changes in database schema for national codes and SMS settings.
140 lines
3.0 KiB
Markdown
140 lines
3.0 KiB
Markdown
# Staff API
|
|
|
|
مدیریت پرسنل مطب/کلینیک (بدون حذف — فقط toggle فعال/غیرفعال).
|
|
|
|
---
|
|
|
|
## GET /api/v1/staff
|
|
|
|
دریافت لیست پرسنل entity جاری (از JWT).
|
|
|
|
**Permission:** `IS_AUTHENTICATED_FULLY` (ROLE_DOCTOR یا ROLE_CLINIC)
|
|
|
|
**Response 200:**
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": [
|
|
{
|
|
"uuid": "a1b2c3d4-...",
|
|
"entity_type": "clinic",
|
|
"entity_id": 5,
|
|
"full_name": "علی محمدی",
|
|
"phone": "09121234567",
|
|
"job_title": "منشی",
|
|
"address": null,
|
|
"national_code": "0012345678",
|
|
"active": true,
|
|
"created_at": 1718000000,
|
|
"updated_at": 1718000000
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## POST /api/v1/staff
|
|
|
|
ایجاد پرسنل جدید.
|
|
|
|
**Permission:** `IS_AUTHENTICATED_FULLY` (ROLE_DOCTOR یا ROLE_CLINIC)
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"full_name": "علی محمدی",
|
|
"phone": "09121234567",
|
|
"job_title": "منشی",
|
|
"address": "تهران، خیابان ولیعصر",
|
|
"national_code": "0012345678"
|
|
}
|
|
```
|
|
|
|
| فیلد | نوع | الزامی |
|
|
|------|-----|--------|
|
|
| full_name | string | ✅ |
|
|
| phone | string | ❌ |
|
|
| job_title | string | ❌ |
|
|
| address | string | ❌ |
|
|
| national_code | string(15) — ارقام فارسی به لاتین تبدیل میشوند | ❌ |
|
|
|
|
**Response 201:**
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": {
|
|
"uuid": "a1b2c3d4-...",
|
|
"entity_type": "clinic",
|
|
"entity_id": 5,
|
|
"full_name": "علی محمدی",
|
|
"phone": "09121234567",
|
|
"job_title": "منشی",
|
|
"address": "تهران، خیابان ولیعصر",
|
|
"national_code": "0012345678",
|
|
"active": true,
|
|
"created_at": 1718000000,
|
|
"updated_at": 1718000000
|
|
}
|
|
}
|
|
```
|
|
|
|
**Errors:**
|
|
| Code | HTTP | توضیح |
|
|
|------|------|-------|
|
|
| ERR_VALIDATION_001 | 422 | full_name خالی است |
|
|
| ERR_FORBIDDEN_001 | 403 | پروفایل doctor/clinic یافت نشد |
|
|
|
|
---
|
|
|
|
## PATCH /api/v1/staff/{uuid}
|
|
|
|
ویرایش اطلاعات پرسنل.
|
|
|
|
**Permission:** `IS_AUTHENTICATED_FULLY` — فقط owner یا ROLE_ADMIN
|
|
|
|
**Request Body (همه فیلدها اختیاری):**
|
|
```json
|
|
{
|
|
"full_name": "علی محمدی ویرایششده",
|
|
"phone": "09129999999",
|
|
"job_title": "منشی ارشد",
|
|
"address": null,
|
|
"national_code": null
|
|
}
|
|
```
|
|
|
|
**Response 200:** همان ساختار staff object
|
|
|
|
**Errors:**
|
|
| Code | HTTP | توضیح |
|
|
|------|------|-------|
|
|
| ERR_STAFF_NOT_FOUND | 404 | پرسنل یافت نشد |
|
|
| ERR_FORBIDDEN_001 | 403 | دسترسی ندارید |
|
|
|
|
---
|
|
|
|
## PATCH /api/v1/staff/{uuid}/toggle
|
|
|
|
تغییر وضعیت فعال/غیرفعال پرسنل (soft toggle — هیچ حذفی انجام نمیشود).
|
|
|
|
**Permission:** `IS_AUTHENTICATED_FULLY` — فقط owner یا ROLE_ADMIN
|
|
|
|
**Response 200:**
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": {
|
|
"uuid": "a1b2c3d4-...",
|
|
"active": false,
|
|
...
|
|
}
|
|
}
|
|
```
|
|
|
|
**Errors:**
|
|
| Code | HTTP | توضیح |
|
|
|------|------|-------|
|
|
| ERR_STAFF_NOT_FOUND | 404 | پرسنل یافت نشد |
|
|
| ERR_FORBIDDEN_001 | 403 | دسترسی ندارید |
|