refactor(errors): centralise legacy string error codes in ErrorCodes (M21)
~27 ad-hoc error codes (SLOT_TAKEN, USER_NOT_FOUND, VALIDATION, …) were raw strings, so ErrorCodes::message() returned the "unknown" fallback for them. Register all 14 distinct codes as constants with their messages and replace the raw usages across AdminApiController, MyAppointmentsController, CategoryController, PreRegistrationController and ClinicInvitationController. Wire values are kept identical (verified no consumer — admin SPA, nobat724_front, tauri — switches on these strings), so this is backward compatible. Regression: tests/Shared/ErrorCodesTest (wire values preserved + message resolves). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -63,7 +63,7 @@ class PreRegistrationController extends BaseController
|
||||
}
|
||||
|
||||
if ($this->preRegRepo->hasPendingForMobile($mobile)) {
|
||||
return $this->error('DUPLICATE_REQUEST', 'درخواست ثبتنام شما در حال بررسی است', 409);
|
||||
return $this->error(ErrorCodes::DUPLICATE_REQUEST, 'درخواست ثبتنام شما در حال بررسی است', 409);
|
||||
}
|
||||
|
||||
$preReg = new PreRegistration($type, $name, $mobile, $info);
|
||||
|
||||
Reference in New Issue
Block a user