feat(secretary): enhance secretary management with name input and toggle activation feature
This commit is contained in:
@@ -78,6 +78,9 @@ class SecretaryController extends BaseController
|
||||
$secretaryUser->setPasswordHash($hash);
|
||||
}
|
||||
}
|
||||
if (!empty($data['name'])) {
|
||||
$secretaryUser->setRealName(trim($data['name']));
|
||||
}
|
||||
|
||||
// Assign ROLE_SECRETARY
|
||||
$roles = $secretaryUser->getRoles();
|
||||
@@ -151,7 +154,7 @@ class SecretaryController extends BaseController
|
||||
}
|
||||
|
||||
#[Route('/api/v1/secretary/{uuid}', methods: ['DELETE'])]
|
||||
public function delete(string $uuid, #[CurrentUser] User $currentUser): JsonResponse
|
||||
public function deactivate(string $uuid, #[CurrentUser] User $currentUser): JsonResponse
|
||||
{
|
||||
$secretary = $this->secretaryRepo->findByUuid($uuid);
|
||||
if ($secretary === null) {
|
||||
@@ -162,9 +165,10 @@ class SecretaryController extends BaseController
|
||||
return $this->error(ErrorCodes::ERR_AUTH_006, 'دسترسی ممنوع', 403);
|
||||
}
|
||||
|
||||
$this->secretaryRepo->remove($secretary);
|
||||
$secretary->setActive(false);
|
||||
$this->secretaryRepo->save($secretary);
|
||||
|
||||
return $this->success(['message' => 'منشی با موفقیت حذف شد']);
|
||||
return $this->success(['message' => 'منشی غیرفعال شد']);
|
||||
}
|
||||
|
||||
/** لیست منشیان مطب شخصی یک دکتر */
|
||||
|
||||
Reference in New Issue
Block a user