multa a medias
This commit is contained in:
parent
38183be1f8
commit
d31cc80069
@ -1,10 +1,12 @@
|
||||
import {
|
||||
Body,
|
||||
ConflictException,
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
Request,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
@ -17,6 +19,7 @@ import {
|
||||
} from '@nestjs/swagger';
|
||||
import { Serealize } from '../interceptors/serialize.interceptor';
|
||||
import { MultaService } from './multa.service';
|
||||
import { Operador } from 'src/operador/entity/operador.entity';
|
||||
import { IdUsuarioDto } from '../dto/id-usuario.dto';
|
||||
import { IdEquipoPaginaDto } from '../dto/id-equipo-pagina.dto';
|
||||
import { MultarDto } from './dto/input/multar.dto';
|
||||
@ -50,7 +53,17 @@ export class MultaController {
|
||||
},
|
||||
},
|
||||
})
|
||||
multar(@Body() body: MultarDto) {
|
||||
multar(@Request() req, @Body() body: MultarDto) {
|
||||
const operador: Operador = req.user.operador;
|
||||
|
||||
if (
|
||||
!operador ||
|
||||
(operador.tipoUsuario.id_tipo_usuario != 3 &&
|
||||
operador.tipoUsuario.id_tipo_usuario != 4)
|
||||
)
|
||||
throw new ConflictException(
|
||||
'No tienes permisos para realizar esta acción.',
|
||||
);
|
||||
return this.multaService.create(
|
||||
body.id_prestamo,
|
||||
body.id_operador,
|
||||
|
Loading…
Reference in New Issue
Block a user