feat: add localization to expection messages

This commit is contained in:
Abdalhamid Alhamad
2025-01-14 12:39:19 +03:00
parent 5aa3d3774d
commit 6d2d2b558a
6 changed files with 200 additions and 21 deletions
+3 -3
View File
@@ -26,7 +26,7 @@ export class UserService {
if (!user) {
this.logger.error(`User with not found with where clause ${JSON.stringify(where)}`);
throw new BadRequestException('USERS.NOT_FOUND');
throw new BadRequestException('USER.NOT_FOUND');
}
this.logger.log(`User with where clause ${JSON.stringify(where)} found successfully`);
@@ -43,12 +43,12 @@ export class UserService {
}
if (user && user.roles.includes(Roles.GUARDIAN) && user.isProfileCompleted) {
this.logger.error(`User with phone number ${phoneNumber} already exists`);
throw new BadRequestException('USERS.PHONE_NUMBER_ALREADY_EXISTS');
throw new BadRequestException('USER.PHONE_NUMBER_ALREADY_EXISTS');
}
if (user && user.roles.includes(Roles.JUNIOR)) {
this.logger.error(`User with phone number ${phoneNumber} is an already registered junior`);
throw new BadRequestException('USERS.JUNIOR_UPGRADE_NOT_SUPPORTED_YET');
throw new BadRequestException('USER.JUNIOR_UPGRADE_NOT_SUPPORTED_YET');
//TODO add role Guardian to the existing user and send OTP
}