feat(profile): enhance national_code uniqueness error message with masked mobile number

This commit is contained in:
hamed
2026-06-24 12:16:16 +03:30
parent 650e36bce2
commit 8b419d0272
5 changed files with 21 additions and 19 deletions
+2 -1
View File
@@ -149,9 +149,10 @@ class PatientController extends BaseController
if ($nationalCode !== '') {
$owner = $this->profileRepo->findOneByNationalCode($nationalCode);
if ($owner !== null && ($patient === null || $owner->getUser()->getId() !== $patient->getId())) {
$masked = \App\Shared\Service\InputValidator::maskMobile($owner->getUser()->getMobileNumber());
return $this->error(
ErrorCodes::ERR_PROFILE_NATIONAL_CODE_TAKEN,
'این کد ملی قبلاً برای کاربر دیگری ثبت شده است',
"این کد ملی قبلاً با شماره {$masked} ثبت شده است",
409,
'national_code'
);