feat: add filter data scheduling date #178
|
@ -74,10 +74,25 @@ export class IndexDataSchedulingLogManager extends BaseIndexManager<DataScheduli
|
|||
|
||||
if (this.filterParam.schedule_date_to) {
|
||||
const dateTo = this.filterParam.schedule_date_to;
|
||||
queryBuilder.andWhere('schedule_date_from <= :dateTo', {
|
||||
queryBuilder.andWhere('schedule_date_to <= :dateTo', {
|
||||
dateTo: dateTo,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.filterParam.log_created_from) {
|
||||
const dateFrom = this.filterParam.log_created_from;
|
||||
queryBuilder.andWhere('log_created_from >= :dateFrom', {
|
||||
dateFrom: dateFrom,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.filterParam.log_created_to) {
|
||||
const dateTo = this.filterParam.log_created_to;
|
||||
queryBuilder.andWhere('log_created_to <= :dateTo', {
|
||||
dateTo: dateTo,
|
||||
});
|
||||
}
|
||||
|
||||
return queryBuilder;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ export class IndexDataSchedulingManager extends BaseIndexManager<DataSchedulingE
|
|||
|
||||
if (this.filterParam.schedule_date_to) {
|
||||
const dateTo = this.filterParam.schedule_date_to;
|
||||
queryBuilder.andWhere('schedule_date_from <= :dateTo', {
|
||||
queryBuilder.andWhere('schedule_date_to <= :dateTo', {
|
||||
dateTo: dateTo,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { Controller, Get, Param, Query } from '@nestjs/common';
|
||||
import { FilterDataSchedulingDto } from './dto/filter-data-scheduling.dto';
|
||||
import {
|
||||
FilterDataSchedulingDto,
|
||||
FilterDataSchedulingLogDto,
|
||||
} from './dto/filter-data-scheduling.dto';
|
||||
import { Pagination } from 'src/core/response';
|
||||
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
|
||||
import {
|
||||
|
@ -43,7 +46,7 @@ export class DataSchedulingLogReadController {
|
|||
@Pagination()
|
||||
@ExcludePrivilege()
|
||||
async index(
|
||||
@Query() params: FilterDataSchedulingDto,
|
||||
@Query() params: FilterDataSchedulingLogDto,
|
||||
): Promise<PaginationResponse<DataSchedulingLogEntity>> {
|
||||
return await this.orchestrator.indexLog(params);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,27 @@ export class FilterDataSchedulingDto
|
|||
schedule_date_to: Date;
|
||||
}
|
||||
|
||||
export class FilterDataSchedulingLogDto
|
||||
extends BaseFilterDto
|
||||
implements FilterDataSchedulingEntity
|
||||
{
|
||||
@ApiProperty({ type: 'string', required: false })
|
||||
@ValidateIf((body) => body.schedule_date_from)
|
||||
schedule_date_from: Date;
|
||||
|
||||
@ApiProperty({ type: 'string', required: false })
|
||||
@ValidateIf((body) => body.schedule_date_to)
|
||||
schedule_date_to: Date;
|
||||
|
||||
@ApiProperty({ type: Number, required: false })
|
||||
@ValidateIf((body) => body.log_created_from)
|
||||
log_created_from: number;
|
||||
|
||||
@ApiProperty({ type: Number, required: false })
|
||||
@ValidateIf((body) => body.log_created_to)
|
||||
log_created_to: number;
|
||||
}
|
||||
|
||||
export class FilterActiveDataSchedulingDto {
|
||||
// @ApiProperty({ type: 'string', required: true })
|
||||
// @ValidateIf((body) => body.schedule_date_from)
|
||||
|
|
Loading…
Reference in New Issue