feat(clinic): change clinic_logo from JSON array to single URL string

This commit is contained in:
hamed
2026-06-10 15:09:19 +03:30
parent 28dbfa67e2
commit 30cf2e7a8c
3 changed files with 52 additions and 9 deletions
+11 -4
View File
@@ -59,7 +59,7 @@ class ClinicController extends BaseController
new OA\Property(property: 'state', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'city', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'image_clinic', type: 'array', items: new OA\Items(type: 'string'), nullable: true),
new OA\Property(property: 'clinic_logo', type: 'array', items: new OA\Items(type: 'string'), nullable: true),
new OA\Property(property: 'clinic_logo', type: 'string', nullable: true),
new OA\Property(property: 'doctors', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'specialties', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'doctor_services', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
@@ -158,7 +158,7 @@ class ClinicController extends BaseController
new OA\Property(property: 'state', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'city', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'image_clinic', type: 'array', items: new OA\Items(type: 'string'), nullable: true),
new OA\Property(property: 'clinic_logo', type: 'array', items: new OA\Items(type: 'string'), nullable: true),
new OA\Property(property: 'clinic_logo', type: 'string', nullable: true),
new OA\Property(property: 'doctors', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'specialties', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
new OA\Property(property: 'doctor_services', type: 'array', items: new OA\Items(type: 'integer'), nullable: true),
@@ -417,8 +417,15 @@ class ClinicController extends BaseController
if (array_key_exists('image_clinic', $data) && is_array($data['image_clinic'])) {
$clinic->setImagesClinic($data['image_clinic']);
}
if (array_key_exists('clinic_logo', $data) && is_array($data['clinic_logo'])) {
$clinic->setClinicLogo($data['clinic_logo']);
if (array_key_exists('clinic_logo', $data)) {
$logo = $data['clinic_logo'];
// Accept either a plain URL string or an upload-response object with 'url' key
if (is_array($logo) && isset($logo['url'])) {
$logo = $logo['url'];
} elseif (is_array($logo) && !empty($logo[0]['url'])) {
$logo = $logo[0]['url'];
}
$clinic->setClinicLogo(is_string($logo) ? $logo : null);
}
// ManyToMany: doctors