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