Commit bd24996a authored by Omar Luna Hernández's avatar Omar Luna Hernández
Browse files

Se arroja una excepcion cuando se intente crear un admin con un email que ya existe

parent ebf5a1ba
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ export class AuthAdminService {
    };
    const hashedPwd = await this.encryptionService.hashPassword(createAdminDto.password);
    createAdminDto.password = hashedPwd;
    if (await this.adminService.adminExists(createAdminDto.email)) {
      throw new HttpException('Admin already exists', HttpStatus.UNAUTHORIZED);
    }
    await this.adminService.create(createAdminDto);

    const adminSigninResDto: AdminSigninResDto = await this.signIn(loginAdminDto);