operador endpoints restringidos a usuario
This commit is contained in:
parent
f5d65926c5
commit
4a4f4f7aa5
@ -38,7 +38,7 @@ export class HoraExcepcionService {
|
|||||||
institucionDia.institucion.id_institucion
|
institucionDia.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes crear una horario sin servicio en este día porque no le corresponde a tu institución.',
|
'No puedes crear una horario sin servicio en este día porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
if (hora_inicio > hora_fin)
|
if (hora_inicio > hora_fin)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
@ -102,7 +102,7 @@ export class HoraExcepcionService {
|
|||||||
horaExecpcion.institucionDia.institucion.id_institucion
|
horaExecpcion.institucionDia.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de este tipo de carrito porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de este tipo de carrito porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
(attrs.hora_inicio &&
|
(attrs.hora_inicio &&
|
||||||
|
@ -72,7 +72,7 @@ export class InstitucionDiaService {
|
|||||||
institucionDia.institucion.id_institucion
|
institucionDia.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de este día porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de este día porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
Object.assign(institucionDia, attrs);
|
Object.assign(institucionDia, attrs);
|
||||||
return this.repository.save(institucionDia);
|
return this.repository.save(institucionDia);
|
||||||
|
@ -90,7 +90,7 @@ export class InstitucionInfraccionService {
|
|||||||
institucionInfraccion.institucion.id_institucion
|
institucionInfraccion.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de esta infraccion porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de esta infraccion porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
Object.assign(institucionInfraccion, attrs);
|
Object.assign(institucionInfraccion, attrs);
|
||||||
return this.institucionInfraccionRepository.save(institucionInfraccion);
|
return this.institucionInfraccionRepository.save(institucionInfraccion);
|
||||||
|
@ -107,7 +107,7 @@ export class InstitucionProgramaService {
|
|||||||
institucionPrograma.institucion.id_institucion
|
institucionPrograma.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de este software porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de este software porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
Object.assign(institucionPrograma, attrs);
|
Object.assign(institucionPrograma, attrs);
|
||||||
return this.institucionProgramaRepository.save(institucionPrograma);
|
return this.institucionProgramaRepository.save(institucionPrograma);
|
||||||
|
@ -121,7 +121,7 @@ export class InstitucionTipoCarritoService {
|
|||||||
institucionTipoCarrito.institucion.id_institucion
|
institucionTipoCarrito.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de este tipo de carrito porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de este tipo de carrito porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
Object.assign(institucionTipoCarrito, attrs);
|
Object.assign(institucionTipoCarrito, attrs);
|
||||||
return this.institucionTipoCarritoRepository.save(
|
return this.institucionTipoCarritoRepository.save(
|
||||||
|
@ -115,7 +115,7 @@ export class InstitucionTipoEntradaService {
|
|||||||
institucionTipoEntrada.institucion.id_institucion
|
institucionTipoEntrada.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de este tipo de carrito porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de este tipo de carrito porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
Object.assign(institucionTipoEntrada, attrs);
|
Object.assign(institucionTipoEntrada, attrs);
|
||||||
return this.institucionTipoEntradaRepository.save(
|
return this.institucionTipoEntradaRepository.save(
|
||||||
|
@ -99,7 +99,7 @@ export class ModuloService {
|
|||||||
admin.institucion.id_institucion != modulo.institucion.id_institucion
|
admin.institucion.id_institucion != modulo.institucion.id_institucion
|
||||||
)
|
)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'No puedes actualizar la información de este módulo porque no le corresponde a tu institución.',
|
'No puedes actualizar la información de este módulo porque no le pertenece a tu institución.',
|
||||||
);
|
);
|
||||||
if (attrs.modulo)
|
if (attrs.modulo)
|
||||||
await this.existeModulo(modulo.institucion, attrs.modulo);
|
await this.existeModulo(modulo.institucion, attrs.modulo);
|
||||||
|
23
src/operador/dto/input/create-admin.dto.ts
Normal file
23
src/operador/dto/input/create-admin.dto.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import {
|
||||||
|
IsEmail,
|
||||||
|
IsInt,
|
||||||
|
IsNotEmpty,
|
||||||
|
IsString,
|
||||||
|
MaxLength,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
|
export class CreateAdminDto {
|
||||||
|
@IsEmail()
|
||||||
|
correo: string;
|
||||||
|
|
||||||
|
@IsInt()
|
||||||
|
id_institucion: number;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@MaxLength(40)
|
||||||
|
nombre: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
operador: string;
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
IsEmail,
|
IsEmail,
|
||||||
IsInt,
|
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsOptional,
|
IsOptional,
|
||||||
IsString,
|
IsString,
|
||||||
@ -11,12 +10,6 @@ export class CreateOperadorDto {
|
|||||||
@IsEmail()
|
@IsEmail()
|
||||||
correo: string;
|
correo: string;
|
||||||
|
|
||||||
@IsInt()
|
|
||||||
id_institucion: number;
|
|
||||||
|
|
||||||
@IsInt()
|
|
||||||
id_tipo_usuario: number;
|
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@MaxLength(40)
|
@MaxLength(40)
|
||||||
@ -28,5 +21,5 @@ export class CreateOperadorDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
password?: string;
|
password: string;
|
||||||
}
|
}
|
@ -1,10 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
Body,
|
Body,
|
||||||
|
ConflictException,
|
||||||
Controller,
|
Controller,
|
||||||
Get,
|
Get,
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
Query,
|
Query,
|
||||||
|
Request,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { AuthGuard } from '@nestjs/passport';
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
@ -17,7 +19,9 @@ import {
|
|||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { Serealize } from '../interceptors/serialize.interceptor';
|
import { Serealize } from '../interceptors/serialize.interceptor';
|
||||||
import { OperadorService } from './operador.service';
|
import { OperadorService } from './operador.service';
|
||||||
import { CreateOperadorDto } from './dto/input/create.dto';
|
import { Operador } from './entity/operador.entity';
|
||||||
|
import { CreateAdminDto } from './dto/input/create-admin.dto';
|
||||||
|
import { CreateOperadorDto } from './dto/input/create-operador.dto';
|
||||||
import { OperadorDto } from './dto/input/operador.dto';
|
import { OperadorDto } from './dto/input/operador.dto';
|
||||||
import { OperadoresDto } from './dto/input/operadores.dto';
|
import { OperadoresDto } from './dto/input/operadores.dto';
|
||||||
import { UpdateOperadorDto } from './dto/input/update.dto';
|
import { UpdateOperadorDto } from './dto/input/update.dto';
|
||||||
@ -28,7 +32,40 @@ import { OperadorOutputDto } from './dto/output/operador.dto';
|
|||||||
export class OperadorController {
|
export class OperadorController {
|
||||||
constructor(private operadorService: OperadorService) {}
|
constructor(private operadorService: OperadorService) {}
|
||||||
|
|
||||||
@Post()
|
@Post('admin')
|
||||||
|
@UseGuards(AuthGuard('jwt'))
|
||||||
|
@ApiOperation({ description: 'Endpoint que crea un admin.' })
|
||||||
|
@ApiBearerAuth('jwt')
|
||||||
|
@ApiBody({
|
||||||
|
description: 'Todas las variables son obligatorias.',
|
||||||
|
examples: {
|
||||||
|
ejemplo: {
|
||||||
|
value: {
|
||||||
|
correo: '',
|
||||||
|
id_institucion: 200,
|
||||||
|
nombre: '',
|
||||||
|
operador: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
createAdmin(@Request() req, @Body() body: CreateAdminDto) {
|
||||||
|
const admin: Operador = req.user.operador;
|
||||||
|
|
||||||
|
if (!admin || admin.tipoUsuario.id_tipo_usuario != 2)
|
||||||
|
throw new ConflictException(
|
||||||
|
'No tienes permisos para realizar esta acción.',
|
||||||
|
);
|
||||||
|
return this.operadorService.create(
|
||||||
|
body.id_institucion,
|
||||||
|
3,
|
||||||
|
body.operador,
|
||||||
|
body.nombre,
|
||||||
|
body.correo,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('operador')
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@ApiOperation({ description: 'Endpoint que crea un operador.' })
|
@ApiOperation({ description: 'Endpoint que crea un operador.' })
|
||||||
@ApiBearerAuth('jwt')
|
@ApiBearerAuth('jwt')
|
||||||
@ -38,8 +75,6 @@ export class OperadorController {
|
|||||||
ejemplo: {
|
ejemplo: {
|
||||||
value: {
|
value: {
|
||||||
correo: '',
|
correo: '',
|
||||||
id_institucion: 200,
|
|
||||||
id_tipo_usuario: 4,
|
|
||||||
nombre: '',
|
nombre: '',
|
||||||
operador: '',
|
operador: '',
|
||||||
password: '',
|
password: '',
|
||||||
@ -47,10 +82,16 @@ export class OperadorController {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
create(@Body() body: CreateOperadorDto) {
|
createOperador(@Request() req, @Body() body: CreateOperadorDto) {
|
||||||
|
const admin: Operador = req.user.operador;
|
||||||
|
|
||||||
|
if (!admin || admin.tipoUsuario.id_tipo_usuario != 3)
|
||||||
|
throw new ConflictException(
|
||||||
|
'No tienes permisos para realizar esta acción.',
|
||||||
|
);
|
||||||
return this.operadorService.create(
|
return this.operadorService.create(
|
||||||
body.id_institucion,
|
admin.institucion,
|
||||||
body.id_tipo_usuario,
|
4,
|
||||||
body.operador,
|
body.operador,
|
||||||
body.nombre,
|
body.nombre,
|
||||||
body.correo,
|
body.correo,
|
||||||
@ -70,7 +111,17 @@ export class OperadorController {
|
|||||||
name: 'id_operador',
|
name: 'id_operador',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
})
|
})
|
||||||
operador(@Query() query: OperadorDto) {
|
operador(@Request() req, @Query() query: OperadorDto) {
|
||||||
|
const admin: Operador = req.user.operador;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!admin ||
|
||||||
|
(admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||||
|
admin.tipoUsuario.id_tipo_usuario != 3)
|
||||||
|
)
|
||||||
|
throw new ConflictException(
|
||||||
|
'No tienes permisos para acceder a esta información.',
|
||||||
|
);
|
||||||
return this.operadorService.findById(parseInt(query.id_operador));
|
return this.operadorService.findById(parseInt(query.id_operador));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,15 +156,20 @@ export class OperadorController {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
required: false,
|
required: false,
|
||||||
})
|
})
|
||||||
operadores(@Query() query: OperadoresDto) {
|
operadores(@Request() req, @Query() query: OperadoresDto) {
|
||||||
|
const admin: Operador = req.user.operador;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!admin ||
|
||||||
|
(admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||||
|
admin.tipoUsuario.id_tipo_usuario != 3)
|
||||||
|
)
|
||||||
|
throw new ConflictException(
|
||||||
|
'No tienes permisos para acceder a esta información.',
|
||||||
|
);
|
||||||
return this.operadorService.findAll(query);
|
return this.operadorService.findAll(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Get('reporte')
|
|
||||||
// @UseGuards(AuthGuard('jwt'))
|
|
||||||
// @ApiBearerAuth('jwt')
|
|
||||||
// reporte() {}
|
|
||||||
|
|
||||||
@Put('update-password')
|
@Put('update-password')
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
@ -124,10 +180,29 @@ export class OperadorController {
|
|||||||
description: 'Es obligatorio enviar el campo id_operador.',
|
description: 'Es obligatorio enviar el campo id_operador.',
|
||||||
examples: { ejemplo: { value: { id_operador: 4 } } },
|
examples: { ejemplo: { value: { id_operador: 4 } } },
|
||||||
})
|
})
|
||||||
passwordResset(@Body() body: UpdateOperadorDto) {
|
passwordResset(@Request() req, @Body() body: UpdateOperadorDto) {
|
||||||
return this.operadorService.passwordReset(body.id_operador, body.password);
|
const admin: Operador = req.user.operador;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!admin ||
|
||||||
|
(admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||||
|
admin.tipoUsuario.id_tipo_usuario != 3)
|
||||||
|
)
|
||||||
|
throw new ConflictException(
|
||||||
|
'No tienes permisos para realizar esta acción.',
|
||||||
|
);
|
||||||
|
return this.operadorService.passwordReset(
|
||||||
|
admin,
|
||||||
|
body.id_operador,
|
||||||
|
body.password,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Get('reporte')
|
||||||
|
// @UseGuards(AuthGuard('jwt'))
|
||||||
|
// @ApiBearerAuth('jwt')
|
||||||
|
// reporte() {}
|
||||||
|
|
||||||
@Put()
|
@Put()
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
@ -141,7 +216,17 @@ export class OperadorController {
|
|||||||
ejemplo: { value: { id_operador: 3, _activo: true, _password: '' } },
|
ejemplo: { value: { id_operador: 3, _activo: true, _password: '' } },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
update(@Body() body: UpdateOperadorDto) {
|
update(@Request() req, @Body() body: UpdateOperadorDto) {
|
||||||
return this.operadorService.update(body);
|
const admin: Operador = req.user.operador;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!admin ||
|
||||||
|
(admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||||
|
admin.tipoUsuario.id_tipo_usuario != 3)
|
||||||
|
)
|
||||||
|
throw new ConflictException(
|
||||||
|
'No tienes permisos para realizar esta acción.',
|
||||||
|
);
|
||||||
|
return this.operadorService.update(admin, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export class OperadorService {
|
|||||||
private tipoUsuarioService: TipoUsuarioService,
|
private tipoUsuarioService: TipoUsuarioService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
correoPasswordAdmin(operador, password: string) {
|
private correoPasswordAdmin(operador, password: string) {
|
||||||
return `<h2>Estimad@ Responsable del programa PC Puma:</h2>
|
return `<h2>Estimad@ Responsable del programa PC Puma:</h2>
|
||||||
<p>Su registro se ha realizado exitosamente, para acceder al servicio del sistema de préstamo deberá hacerlo con los siguientes datos:</p>
|
<p>Su registro se ha realizado exitosamente, para acceder al servicio del sistema de préstamo deberá hacerlo con los siguientes datos:</p>
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ export class OperadorService {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
correoPasswordOperador(operador, password: string) {
|
private correoPasswordOperador(operador, password: string) {
|
||||||
return `<h2>Estimad@ operador del servicio de préstamo PC Puma, su registro se realizó con éxito.</h2>
|
return `<h2>Estimad@ operador del servicio de préstamo PC Puma, su registro se realizó con éxito.</h2>
|
||||||
<p>Para acceder al servicio debe hacerlo con los siguientes datos:</p>
|
<p>Para acceder al servicio debe hacerlo con los siguientes datos:</p>
|
||||||
|
|
||||||
@ -91,14 +91,17 @@ export class OperadorService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async create(
|
async create(
|
||||||
id_institucion: number,
|
id_institucion: number | Institucion,
|
||||||
id_tipo_usuario: number,
|
id_tipo_usuario: number,
|
||||||
operador: string,
|
operador: string,
|
||||||
nombre: string,
|
nombre: string,
|
||||||
correo: string,
|
correo: string,
|
||||||
password?: string,
|
password?: string,
|
||||||
) {
|
) {
|
||||||
const institucion = await this.institucionService.findById(id_institucion);
|
const institucion =
|
||||||
|
typeof id_institucion === 'number'
|
||||||
|
? await this.institucionService.findById(id_institucion)
|
||||||
|
: id_institucion;
|
||||||
const tipoUsuario = await this.tipoUsuarioService.findById(id_tipo_usuario);
|
const tipoUsuario = await this.tipoUsuarioService.findById(id_tipo_usuario);
|
||||||
|
|
||||||
if (tipoUsuario.id_tipo_usuario < 3 || tipoUsuario.id_tipo_usuario > 4)
|
if (tipoUsuario.id_tipo_usuario < 3 || tipoUsuario.id_tipo_usuario > 4)
|
||||||
@ -224,9 +227,10 @@ export class OperadorService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordReset(id_operador: number, password?: string) {
|
passwordReset(admin: Operador, id_operador: number, password?: string) {
|
||||||
return this.findById(id_operador)
|
return this.findById(id_operador)
|
||||||
.then((operador) => {
|
.then((operador) => {
|
||||||
|
this.validarUpdate(admin, operador);
|
||||||
if (!password) password = this.bcryptService.generarPassword();
|
if (!password) password = this.bcryptService.generarPassword();
|
||||||
operador.password = this.bcryptService.encriptar(password);
|
operador.password = this.bcryptService.encriptar(password);
|
||||||
return this.repository.save(operador);
|
return this.repository.save(operador);
|
||||||
@ -234,23 +238,22 @@ export class OperadorService {
|
|||||||
.then((operador) =>
|
.then((operador) =>
|
||||||
this.nodemailerService.sendEmail({
|
this.nodemailerService.sendEmail({
|
||||||
email: operador.correo,
|
email: operador.correo,
|
||||||
subject: 'Credenciales Pc Puma',
|
subject: 'Credenciales PC Puma',
|
||||||
html:
|
html:
|
||||||
operador.tipoUsuario.id_tipo_usuario === 3
|
operador.tipoUsuario.id_tipo_usuario === 3
|
||||||
? this.correoPasswordAdmin(operador.correo, password)
|
? this.correoPasswordAdmin(operador.operador, password)
|
||||||
: this.correoPasswordOperador(operador.correo, password),
|
: this.correoPasswordOperador(operador.operador, password),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.then((_) => ({
|
.then((_) => ({
|
||||||
message: 'Se cambió correctamente la constraseña del operador.',
|
message: 'Se cambió correctamente la constraseña.',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
update(attrs: Partial<Operador>) {
|
update(admin: Operador, attrs: Partial<Operador>) {
|
||||||
return this.findById(attrs.id_operador)
|
return this.findById(attrs.id_operador)
|
||||||
.then((operador) => {
|
.then((operador) => {
|
||||||
if (attrs.password)
|
this.validarUpdate(admin, operador);
|
||||||
attrs.password = this.bcryptService.encriptar(attrs.password);
|
|
||||||
Object.assign(operador, attrs);
|
Object.assign(operador, attrs);
|
||||||
return this.repository.save(operador);
|
return this.repository.save(operador);
|
||||||
})
|
})
|
||||||
@ -258,4 +261,21 @@ export class OperadorService {
|
|||||||
message: 'Se guardaron los cambios correctamente.',
|
message: 'Se guardaron los cambios correctamente.',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validarUpdate(admin: Operador, operador: Operador) {
|
||||||
|
if (
|
||||||
|
admin.tipoUsuario.id_tipo_usuario === 2 &&
|
||||||
|
operador.tipoUsuario.id_tipo_usuario != 3
|
||||||
|
)
|
||||||
|
throw new ConflictException(
|
||||||
|
`El super admin solo puede modificar la infomración de los admins.`,
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
admin.tipoUsuario.id_tipo_usuario === 3 &&
|
||||||
|
admin.institucion.id_institucion != operador.institucion.id_institucion
|
||||||
|
)
|
||||||
|
throw new ConflictException(
|
||||||
|
`No puedes actualizar la información de este ${operador.tipoUsuario.tipo_usuario.toLowerCase()} porque no pertenece a tu institución.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user