listo fechas
This commit is contained in:
Generated
+1661
-1720
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,9 @@
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^9.2.0",
|
||||
"@nestjs/config": "^2.2.0",
|
||||
"@nestjs/core": "^9.2.0",
|
||||
"@nestjs/jwt": "^9.0.0",
|
||||
"@nestjs/passport": "^9.0.0",
|
||||
"@nestjs/platform-express": "^9.0.11",
|
||||
|
||||
+1
-2
@@ -4,8 +4,7 @@ import { ValidationPipe } from '@nestjs/common';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
const app = await NestFactory.create(AppModule)
|
||||
// const config = new DocumentBuilder()
|
||||
// .setTitle('pcpuma_unam_api')
|
||||
// .setDescription('Api de Pc puma')
|
||||
|
||||
@@ -38,6 +38,10 @@ export class HistorialDto {
|
||||
@IsOptional()
|
||||
fechaInicio?: string;
|
||||
|
||||
@IsNumberString()
|
||||
@IsOptional()
|
||||
id_institucion_carrera?: string;
|
||||
|
||||
@IsNumberString()
|
||||
@IsOptional()
|
||||
id_institucion?: string;
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Operador } from '../../../operador/entity/operador.entity';
|
||||
import { Prestamo } from '../prestamo.entity';
|
||||
import { TipoCarrito } from '../../../institucion-tipo-carrito/entity/tipo-carrito.entity';
|
||||
import { Usuario } from '../../../usuario/entity/usuario.entity';
|
||||
import { Carrera } from 'src/institucion-carrera/entity/carrera.entity';
|
||||
|
||||
@ViewEntity({
|
||||
expression: (dataSource: DataSource) =>
|
||||
@@ -43,6 +44,8 @@ import { Usuario } from '../../../usuario/entity/usuario.entity';
|
||||
.addSelect('m.modulo', 'modulo')
|
||||
.addSelect('tc.tipo_carrito', 'tipo_carrito')
|
||||
.addSelect('i.institucion', 'institucion')
|
||||
.addSelect('ca.carrera', 'carrera')
|
||||
.addSelect('ic.id_institucion_carrera', 'id_institucion_carrera')
|
||||
.from(Prestamo, 'p')
|
||||
.innerJoin(Equipo, 'e', 'e.id_equipo = p.id_equipo')
|
||||
.innerJoin(Operador, 'oe', 'oe.id_operador = p.id_operador_regreso')
|
||||
@@ -58,6 +61,7 @@ import { Usuario } from '../../../usuario/entity/usuario.entity';
|
||||
.innerJoin(Modulo, 'm', 'm.id_modulo = c.id_modulo')
|
||||
.innerJoin(TipoCarrito, 'tc', 'tc.id_tipo_carrito = c.id_tipo_carrito')
|
||||
.innerJoin(Institucion, 'i', 'i.id_institucion = m.id_institucion')
|
||||
.innerJoin(Carrera, 'ca', 'ca.id_carrera = ic.id_carrera')
|
||||
.where('i.id_institucion = ic.id_institucion')
|
||||
.orderBy('i.institucion'),
|
||||
})
|
||||
@@ -68,6 +72,9 @@ export class FullInformacionPrestamoView {
|
||||
@ViewColumn()
|
||||
activo: number;
|
||||
|
||||
@ViewColumn()
|
||||
carrera: string;
|
||||
|
||||
@ViewColumn()
|
||||
cancelado_operador: number;
|
||||
|
||||
@@ -104,6 +111,9 @@ export class FullInformacionPrestamoView {
|
||||
@ViewColumn()
|
||||
id_institucion: number;
|
||||
|
||||
@ViewColumn()
|
||||
id_institucion_carrera: number;
|
||||
|
||||
@ViewColumn()
|
||||
id_modulo: number;
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import {
|
||||
Between,
|
||||
FindManyOptions,
|
||||
FindOptionsWhere,
|
||||
LessThanOrEqual,
|
||||
Like,
|
||||
MoreThanOrEqual,
|
||||
Repository,
|
||||
@@ -373,6 +373,7 @@ export class PrestamoService {
|
||||
fechaFin?: string;
|
||||
fechaInicio?: string;
|
||||
id_institucion?: string;
|
||||
id_institucion_carrera?: string;
|
||||
id_modulo?: string;
|
||||
id_operador_entrega?: string;
|
||||
id_operador_regreso?: string;
|
||||
@@ -423,15 +424,26 @@ export class PrestamoService {
|
||||
filtros.cancelado_operador === 'true' ? 1 : 0;
|
||||
if (filtros.cancelado_usuario)
|
||||
busqueda.cancelado_usuario = filtros.cancelado_usuario === 'true' ? 1 : 0;
|
||||
if (filtros.fechaInicio)
|
||||
busqueda.fecha_inicio = MoreThanOrEqual(new Date(filtros.fechaInicio));
|
||||
if (filtros.fechaFin)
|
||||
busqueda.fecha_inicio = LessThanOrEqual(new Date(filtros.fechaFin));
|
||||
if (filtros.fechaInicio) {
|
||||
if (filtros.fechaFin)
|
||||
busqueda.fecha_inicio = Between(
|
||||
new Date(`${filtros.fechaInicio} 00:00`),
|
||||
new Date(`${filtros.fechaFin} 23:59`),
|
||||
);
|
||||
else
|
||||
busqueda.fecha_inicio = MoreThanOrEqual(
|
||||
new Date(`${filtros.fechaInicio} 00:00`),
|
||||
);
|
||||
}
|
||||
if (filtros.id_prestamo)
|
||||
busqueda.id_prestamo = parseInt(filtros.id_prestamo);
|
||||
if (filtros.carrito) busqueda.carrito = Like(`%${filtros.carrito}%`);
|
||||
if (filtros.equipo) busqueda.equipo = Like(`%${filtros.equipo}%`);
|
||||
if (filtros.usuario) busqueda.usuario = Like(`%${filtros.usuario}%`);
|
||||
if (filtros.id_institucion_carrera)
|
||||
busqueda.id_institucion_carrera = parseInt(
|
||||
filtros.id_institucion_carrera,
|
||||
);
|
||||
if (institucion) busqueda.id_institucion = institucion.id_institucion;
|
||||
if (modulo) busqueda.id_modulo = modulo.id_modulo;
|
||||
if (tipoCarrito) busqueda.id_tipo_carrito = tipoCarrito.id_tipo_carrito;
|
||||
|
||||
Reference in New Issue
Block a user