Refactor doctor name handling across the application

- Removed the "دکتر" prefix from doctor names in various components and API responses to ensure consistency and clarity.
- Updated the AppointmentDetailPage, CommentsPage, DashboardPage, RatingsPage, SecretariesPage, and other relevant files to reflect the changes in doctor name formatting.
- Adjusted API documentation to align with the new naming conventions.
- Implemented validation to prevent the creation of clinics without a name and restricted users to a single clinic.
- Added tests to verify that doctor names are stored without titles and that clinic creation adheres to the new validation rules.
This commit is contained in:
hamed
2026-07-19 16:09:55 +03:30
parent 7761c37a3e
commit b05aeaf58b
30 changed files with 260 additions and 71 deletions
@@ -99,6 +99,19 @@ class ClinicController extends BaseController
if (($err = $this->validateGallerySize($data)) !== null) {
return $err;
}
// بدون نام، کلینیکِ بی‌هویت ساخته می‌شد که در هیچ لیستی قابل‌تشخیص نیست.
if (trim((string) ($data['name'] ?? '')) === '') {
return $this->error(ErrorCodes::ERR_VALIDATION_001, 'نام کلینیک الزامی است', 422, 'name');
}
// یک کلینیک به ازای هر کاربر: ClinicRepository::findByUser() — که محیط کاری
// کاربر از آن حل می‌شود — findOneBy است، پس کلینیک دوم به بعد هرگز انتخاب
// نمی‌شود و به دادهٔ یتیم تبدیل می‌شود.
if ($this->clinicRepo->findByUser($user) !== null) {
return $this->error(ErrorCodes::ERR_CONFLICT_001, 'برای این کاربر کلینیک ثبت شده است', 409);
}
$clinic = new Clinic($user);
$this->hydrateClinic($clinic, $data);
$this->clinicRepo->save($clinic);