Commit a3e681a7 authored by Diego Iván's avatar Diego Iván
Browse files

agregando excepcion cuando hay un usuario repetido

parent 83fa6b52
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
import {
  BadRequestException,
  HttpException,
  HttpStatus,
  Injectable,
} from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { EncryptionService } from '../encryption/encryption.service';
import { JwtConstants } from 'src/constants/jwt.constants';
@@ -25,6 +30,9 @@ export class AuthUserService {
      createAdminDto.password,
    );
    createAdminDto.password = hashedPwd;
    if (this.userService.userExists(createAdminDto.email)) {
      throw new BadRequestException('User already exists');
    }
    await this.userService.create(createAdminDto);

    const adminSigninResDto: UserSigninResDto =