feat(secretary): enhance secretary management with name input and toggle activation feature

This commit is contained in:
hamed
2026-06-15 12:23:07 +03:30
parent fa6656df48
commit 95f5918118
3 changed files with 113 additions and 31 deletions
@@ -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' => 'منشی غیرفعال شد']);
}
/** لیست منشیان مطب شخصی یک دکتر */