diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 57d761b..adf2167 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -54,7 +54,7 @@ export class AuthService { const modulo = await this.moduloService.findById(id_modulo); return this.operadorService - .findByOperador(id_institucion, operador) + .findByOperador(id_institucion, operador, false) .then((operador) => { if ( !operador || diff --git a/src/operador/operador.service.ts b/src/operador/operador.service.ts index 44e8b14..fe07d57 100644 --- a/src/operador/operador.service.ts +++ b/src/operador/operador.service.ts @@ -36,6 +36,13 @@ export class OperadorService { throw new ConflictException( 'Ya existe un operador con ese nombre, intente de nuevo.', ); + return this.findAdmin(operador, false); + }) + .then((existeAdmin) => { + if (existeAdmin) + throw new ConflictException( + 'Ya existe un admin con ese nombre, intente de nuevo.', + ); password = this.bcryptService.encriptar(password); return this.repository.save( this.repository.create({