listo
This commit is contained in:
parent
a4d80e3c31
commit
0960a4c37a
@ -6,7 +6,13 @@ import {
|
||||
Injectable,
|
||||
} from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { FindManyOptions, FindOptionsWhere, Repository } from 'typeorm';
|
||||
import {
|
||||
Between,
|
||||
FindManyOptions,
|
||||
FindOptionsWhere,
|
||||
MoreThanOrEqual,
|
||||
Repository,
|
||||
} from 'typeorm';
|
||||
import { Carrito } from '../carrito/entity/carrito.entity';
|
||||
import { CarritoMotivo } from './entity/carrito-motivo.entity';
|
||||
import { Operador } from '../operador/entity/operador.entity';
|
||||
@ -79,6 +85,8 @@ export class CarritoMotivoService {
|
||||
admin: Operador,
|
||||
filtros: {
|
||||
carrito?: string;
|
||||
fechaFin?: string;
|
||||
fechaInicio?: string;
|
||||
id_institucion?: string;
|
||||
id_marca?: string;
|
||||
id_modelo?: string;
|
||||
@ -109,6 +117,17 @@ export class CarritoMotivoService {
|
||||
};
|
||||
|
||||
if (filtros.carrito) busquedaCarrito.carrito = filtros.carrito;
|
||||
if (filtros.fechaInicio) {
|
||||
if (filtros.fechaFin)
|
||||
busqueda.fecha_creacion = Between(
|
||||
new Date(`${filtros.fechaInicio} 00:00`),
|
||||
new Date(`${filtros.fechaFin} 23:59`),
|
||||
);
|
||||
else
|
||||
busqueda.fecha_creacion = MoreThanOrEqual(
|
||||
new Date(`${filtros.fechaInicio} 00:00`),
|
||||
);
|
||||
}
|
||||
if (admin.institucion)
|
||||
busquedaCarrito.modulo = { institucion: admin.institucion };
|
||||
else if (institucion) busquedaCarrito.modulo = { institucion };
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {
|
||||
IsDateString,
|
||||
IsNotEmpty,
|
||||
IsNumberString,
|
||||
IsOptional,
|
||||
@ -11,6 +12,14 @@ export class LaboratorioMovilDto {
|
||||
@IsOptional()
|
||||
carrito?: string;
|
||||
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
fechaFin?: string;
|
||||
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
fechaInicio?: string;
|
||||
|
||||
@IsNumberString()
|
||||
@IsOptional()
|
||||
id_institucion?: string;
|
||||
|
Loading…
Reference in New Issue
Block a user