feat(migrations): add ownership fields to doctors table for IRIMC import
- Introduced new columns: owner_status, source, source_ref, managed_by, and claimed_at to the doctors table. - Created indexes for owner_status and source to optimize queries related to unclaimed doctors. feat(auth): implement SystemOwnerCommand for managing system-owner user - Added command to create, activate, and deactivate a system-owner user for IRIMC crawler. - Ensured the user has ROLE_ADMIN to access import endpoints. - Handled password setting and user status management within the command.
This commit is contained in:
@@ -41,6 +41,7 @@ class DoctorController extends BaseController
|
||||
private readonly UserRepository $userRepo,
|
||||
private readonly FileValidatorService $fileValidator,
|
||||
private readonly WeeklyScheduleRepository $scheduleRepo,
|
||||
private readonly \App\Appointment\Repository\AppointmentRepository $appointmentRepo,
|
||||
private readonly TenantInsuranceCleanupService $insuranceCleanup,
|
||||
private readonly \App\Representation\Service\DomainContextResolver $domainResolver,
|
||||
private readonly string $projectDir,
|
||||
@@ -375,6 +376,10 @@ class DoctorController extends BaseController
|
||||
return $this->error(ErrorCodes::ERR_VALIDATION_002, 'دکتر یافت نشد', 404);
|
||||
}
|
||||
|
||||
if ($this->appointmentRepo->count(['doctor' => $doctor]) > 0) {
|
||||
return $this->error(ErrorCodes::ERR_CONFLICT_001, 'این پزشک نوبت ثبتشده دارد و قابل حذف نیست', 409);
|
||||
}
|
||||
|
||||
$this->insuranceCleanup->purgeForEntity(TenantInsurance::TYPE_DOCTOR, $doctor->getId());
|
||||
$this->doctorRepo->remove($doctor);
|
||||
return $this->success(['message' => 'دکتر با موفقیت حذف شد']);
|
||||
|
||||
Reference in New Issue
Block a user