chore: check phone is exist in create admin

This commit is contained in:
Matin
2025-02-19 12:06:26 +03:30
parent 8c5e22514f
commit 3099bcf78e
2 changed files with 7 additions and 0 deletions
@@ -210,6 +210,9 @@ export class UsersService {
const existEmail = await this.userRepository.findOneBy({ email: createDto.email });
if (existEmail) throw new BadRequestException(UserMessage.EMAIL_EXIST);
const existPhone = await this.userRepository.findOneBy({ phone: createDto.phone });
if (existPhone) throw new BadRequestException(UserMessage.PHONE_EXIST);
const role = await this.rolesRepository.findOne({ where: { id: createDto.roleId }, relations: { permissions: true } });
if (!role) throw new BadRequestException(AdsMessage.ROLE_NOT_FOUND);