From a4bc89d2ffef4e52148a8bc0e944daced7ac5d79 Mon Sep 17 00:00:00 2001 From: xXpuma99Xx <51341582+xXpuma99Xx@users.noreply.github.com> Date: Mon, 2 May 2022 16:43:55 -0500 Subject: [PATCH] correcion creacion de operadores --- src/auth/auth.service.ts | 2 +- src/operador/operador.service.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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({