pruebas2
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
Request,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
ApiBody,
|
||||
@@ -14,16 +15,15 @@ import {
|
||||
ApiQuery,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Serealize } from '../interceptors/serialize.interceptor';
|
||||
import { ValidarUsuarioService } from '../validar-usuario/validar-usuario.service';
|
||||
import { DevolucionDto } from './dto/input/devolucion.dto';
|
||||
import { DevolucionOutputDto } from './dto/output/devolucion.dto';
|
||||
import { PasscodeService } from './passcode.service';
|
||||
import { NotificacionDto } from './dto/input/notificacion.dto';
|
||||
import { NotificacionOutputDto } from './dto/output/notificacion.dto';
|
||||
import { ValidarUsuarioService } from '../validar-usuario/validar-usuario.service';
|
||||
import { Modulo } from '../modulo/entity/modulo.entity';
|
||||
import { Operador } from '../operador/entity/operador.entity';
|
||||
import { DevolucionDto } from './dto/input/devolucion.dto';
|
||||
import { NotificacionDto } from './dto/input/notificacion.dto';
|
||||
import { PrestamoDto } from './dto/input/prestamo.dto';
|
||||
import { CodeOutputDto } from './dto/output/code.dto';
|
||||
import { PasscodeOutputDto } from './dto/output/passcode.dto';
|
||||
|
||||
@Controller('passcode')
|
||||
@@ -54,7 +54,7 @@ export class PasscodeController {
|
||||
prestamo(@Request() req, @Query() query: PrestamoDto) {
|
||||
const operador: Operador = req.user.operador;
|
||||
|
||||
this.validarUsuarioService.validarAdminOperador(operador);
|
||||
this.validarUsuarioService.validarSoloOperador(operador);
|
||||
return this.passcodeService.findByPasscode(
|
||||
query.passcode,
|
||||
false,
|
||||
@@ -62,7 +62,7 @@ export class PasscodeController {
|
||||
);
|
||||
}
|
||||
|
||||
@Serealize(NotificacionOutputDto)
|
||||
@Serealize(CodeOutputDto)
|
||||
@Put('notificacion')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@ApiOperation({
|
||||
@@ -76,16 +76,18 @@ export class PasscodeController {
|
||||
})
|
||||
autoprestamo(@Request() req, @Body() body: NotificacionDto) {
|
||||
const operador: Operador = req.user.operador;
|
||||
this.validarUsuarioService.validarAdminOperador(operador);
|
||||
const modulo: Modulo = req.user.modulo;
|
||||
|
||||
this.validarUsuarioService.validarSoloOperador(operador);
|
||||
return this.passcodeService.entregarEquipo(
|
||||
operador,
|
||||
modulo,
|
||||
body.passcode,
|
||||
body.estatus,
|
||||
operador,
|
||||
);
|
||||
}
|
||||
|
||||
@Serealize(DevolucionOutputDto)
|
||||
@Serealize(CodeOutputDto)
|
||||
@Put('devolucion')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@ApiOperation({ description: 'Endpoint que da por terminado un préstamo.' })
|
||||
@@ -102,8 +104,9 @@ export class PasscodeController {
|
||||
})
|
||||
devolucion(@Request() req, @Body() body: DevolucionDto) {
|
||||
const operador: Operador = req.user.operador;
|
||||
const modulo: Modulo = req.user.modulo;
|
||||
|
||||
this.validarUsuarioService.validarAdminOperador(operador);
|
||||
return this.passcodeService.devolverEquipo(body.passcode, operador);
|
||||
this.validarUsuarioService.validarSoloOperador(operador);
|
||||
return this.passcodeService.devolverEquipo(operador, modulo, body.passcode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user