prestamo input dto
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
|
||||
export class PrestamoActivosDto {
|
||||
export class ActivosDto {
|
||||
@IsBoolean()
|
||||
activo = true;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsInt } from 'class-validator';
|
||||
|
||||
export class PrestamoCancelarUsuarioDto {
|
||||
export class CancelarUsuarioDto {
|
||||
@IsInt()
|
||||
id_prestamo: number;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsNumberString } from 'class-validator';
|
||||
|
||||
export class PrestamoHistorialEquipoDto {
|
||||
export class HistorialEquipoDto {
|
||||
@IsNumberString()
|
||||
id_equipo: string;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsNumberString } from 'class-validator';
|
||||
|
||||
export class PrestamoHistorialUsuarioDto {
|
||||
export class HistorialUsuarioDto {
|
||||
@IsNumberString()
|
||||
pagina: string;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import {
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
|
||||
export class PrestamoHistorialDto {
|
||||
export class HistorialDto {
|
||||
@IsNumberString()
|
||||
pagina: string;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsNumberString } from 'class-validator';
|
||||
|
||||
export class PrestamoIdPrestamoDto {
|
||||
export class IdPrestamoDto {
|
||||
@IsNumberString()
|
||||
id_prestamo: string;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsNumberString } from 'class-validator';
|
||||
|
||||
export class PrestamoIdUsuarioDto {
|
||||
export class IdUsuarioDto {
|
||||
@IsNumberString()
|
||||
id_usuario: string;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsNumberString, IsString } from 'class-validator';
|
||||
|
||||
export class PrestamoNumeroInventarioDto {
|
||||
export class NumeroInventarioDto {
|
||||
@IsNumberString()
|
||||
id_institucion: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IsInt, IsNumberString, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class PrestamoPedirDto {
|
||||
export class PedirDto {
|
||||
@IsInt()
|
||||
id_modulo: number;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsInt } from 'class-validator';
|
||||
|
||||
export class PrestamoUpdateOperadorDto {
|
||||
export class UpdateOperadorDto {
|
||||
@IsInt()
|
||||
id_operador: number;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||
import { ApiBody, ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
import { PrestamoService } from './prestamo.service';
|
||||
import { PrestamoPedirDto } from './dto/prestamo-pedir.dto';
|
||||
import { PrestamoActivosDto } from './dto/prestamo-activos.dto';
|
||||
import { PrestamoIdUsuarioDto } from './dto/prestamo-id-usuario.dto';
|
||||
import { PrestamoIdPrestamoDto } from './dto/prestamo-id-prestamo.dto';
|
||||
import { PrestamoNumeroInventarioDto } from './dto/prestamo-numero-inventario.dto';
|
||||
import { PrestamoHistorialEquipoDto } from './dto/prestamo-historial-equipo.dto';
|
||||
import { PrestamoHistorialUsuarioDto } from './dto/prestamo-historial-usuario.dto';
|
||||
import { PrestamoHistorialDto } from './dto/prestamo-historial.dto';
|
||||
import { PrestamoUpdateOperadorDto } from './dto/prestamo-update-operador.dto';
|
||||
import { PrestamoCancelarUsuarioDto } from './dto/prestamo-cancelar-usuario.dto';
|
||||
import { PedirDto } from './dto/input/pedir.dto';
|
||||
import { ActivosDto } from './dto/input/activos.dto';
|
||||
import { IdUsuarioDto } from './dto/input/id-usuario.dto';
|
||||
import { IdPrestamoDto } from './dto/input/id-prestamo.dto';
|
||||
import { NumeroInventarioDto } from './dto/input/numero-inventario.dto';
|
||||
import { HistorialEquipoDto } from './dto/input/historial-equipo.dto';
|
||||
import { HistorialUsuarioDto } from './dto/input/historial-usuario.dto';
|
||||
import { HistorialDto } from './dto/input/historial.dto';
|
||||
import { UpdateOperadorDto } from './dto/input/update-operador.dto';
|
||||
import { CancelarUsuarioDto } from './dto/input/cancelar-usuario.dto';
|
||||
|
||||
@Controller('prestamo')
|
||||
@ApiTags('prestamo')
|
||||
@@ -75,7 +75,7 @@ export class PrestamoController {
|
||||
type: 'string',
|
||||
required: false,
|
||||
})
|
||||
activos(@Query() query: PrestamoActivosDto) {
|
||||
activos(@Query() query: ActivosDto) {
|
||||
return this.prestamoService.findAll(query);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class PrestamoController {
|
||||
description: 'Ambas variables son obligatorias.',
|
||||
examples: { ejemplo: { value: { id_prestamo: 1, id_operador: 1 } } },
|
||||
})
|
||||
cancelarOperador(@Body() body: PrestamoUpdateOperadorDto) {
|
||||
cancelarOperador(@Body() body: UpdateOperadorDto) {
|
||||
return this.prestamoService.cancelarOperador(
|
||||
body.id_prestamo,
|
||||
body.id_operador,
|
||||
@@ -102,7 +102,7 @@ export class PrestamoController {
|
||||
description: 'La variable id_prestamo es obligatoria.',
|
||||
examples: { ejemplo: { value: { id_prestamo: 1 } } },
|
||||
})
|
||||
cancelarUsuario(@Body() body: PrestamoCancelarUsuarioDto) {
|
||||
cancelarUsuario(@Body() body: CancelarUsuarioDto) {
|
||||
return this.prestamoService.cancelarUsuario(body.id_prestamo);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export class PrestamoController {
|
||||
description: 'Ambas variables son obligatorias.',
|
||||
examples: { ejemplo: { value: { id_prestamo: 1, id_operador: 4 } } },
|
||||
})
|
||||
entregar(@Body() body: PrestamoUpdateOperadorDto) {
|
||||
entregar(@Body() body: UpdateOperadorDto) {
|
||||
return this.prestamoService.entregar(body.id_prestamo, body.id_operador);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ export class PrestamoController {
|
||||
type: 'string',
|
||||
required: false,
|
||||
})
|
||||
historial(@Query() query: PrestamoHistorialDto) {
|
||||
historial(@Query() query: HistorialDto) {
|
||||
return this.prestamoService.findAll(query);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ export class PrestamoController {
|
||||
name: 'id_equipo',
|
||||
type: 'string',
|
||||
})
|
||||
historialEquipo(@Query() query: PrestamoHistorialEquipoDto) {
|
||||
historialEquipo(@Query() query: HistorialEquipoDto) {
|
||||
return this.prestamoService.findAllByIdEquipo(
|
||||
parseInt(query.id_equipo),
|
||||
parseInt(query.pagina),
|
||||
@@ -229,7 +229,7 @@ export class PrestamoController {
|
||||
name: 'id_usuario',
|
||||
type: 'string',
|
||||
})
|
||||
historialUsuario(@Query() query: PrestamoHistorialUsuarioDto) {
|
||||
historialUsuario(@Query() query: HistorialUsuarioDto) {
|
||||
return this.prestamoService.findAllByIdUsuario(
|
||||
parseInt(query.id_usuario),
|
||||
parseInt(query.pagina),
|
||||
@@ -253,7 +253,7 @@ export class PrestamoController {
|
||||
},
|
||||
},
|
||||
})
|
||||
pedir(@Body() body: PrestamoPedirDto) {
|
||||
pedir(@Body() body: PedirDto) {
|
||||
return this.prestamoService.create(
|
||||
body.id_usuario,
|
||||
body.id_modulo,
|
||||
@@ -266,7 +266,7 @@ export class PrestamoController {
|
||||
@Get('prestamo-id-prestamo')
|
||||
@ApiOperation({ description: 'Endpoint que retorna un préstamo por su id.' })
|
||||
@ApiQuery({ description: '', name: '', type: '' })
|
||||
prestamoIdPrestamo(@Query() query: PrestamoIdPrestamoDto) {
|
||||
prestamoIdPrestamo(@Query() query: IdPrestamoDto) {
|
||||
return this.prestamoService.findById(parseInt(query.id_prestamo));
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ export class PrestamoController {
|
||||
name: 'id_usuario',
|
||||
type: 'string',
|
||||
})
|
||||
prestamoIdUsuario(@Query() query: PrestamoIdUsuarioDto) {
|
||||
prestamoIdUsuario(@Query() query: IdUsuarioDto) {
|
||||
return this.prestamoService.findByIdUsuario(parseInt(query.id_usuario));
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ export class PrestamoController {
|
||||
name: 'numero_inventario',
|
||||
type: 'string',
|
||||
})
|
||||
prestamoNumeroInventario(@Query() query: PrestamoNumeroInventarioDto) {
|
||||
prestamoNumeroInventario(@Query() query: NumeroInventarioDto) {
|
||||
return this.prestamoService.findByNumeroInventario(
|
||||
parseInt(query.id_institucion),
|
||||
query.numero_inventario,
|
||||
@@ -312,7 +312,7 @@ export class PrestamoController {
|
||||
description: 'Ambas variables son obligatorias.',
|
||||
examples: { ejemplo: { value: { id_prestamo: 1, id_operador: 4 } } },
|
||||
})
|
||||
regresar(@Body() body: PrestamoUpdateOperadorDto) {
|
||||
regresar(@Body() body: UpdateOperadorDto) {
|
||||
return this.prestamoService.regresar(body.id_prestamo, body.id_operador);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user