forked from Yara724/api
Fix searching on GET APIs
This commit is contained in:
@@ -28,9 +28,13 @@ import {
|
||||
getUnifiedFileStatusCatalog,
|
||||
resolveUnifiedFileStatus,
|
||||
} from "src/helpers/unified-file-status";
|
||||
import { applyListQueryV2 } from "src/helpers/list-query-v2";
|
||||
import { applyListQueryV2, isInListDateRange, parseListDateRange } from "src/helpers/list-query-v2";
|
||||
import { ClaimCaseDbService } from "src/claim-request-management/entites/db-service/claim-case.db.service";
|
||||
import { ListQueryV2Dto } from "src/common/dto/list-query-v2.dto";
|
||||
import {
|
||||
UnifiedFileStatusReportDto,
|
||||
UnifiedFileStatusReportQueryDto,
|
||||
} from "src/common/dto/unified-file-status-report.dto";
|
||||
import {
|
||||
ExpertFileAssignResultDto,
|
||||
ExpertFileAssignStatus,
|
||||
@@ -156,8 +160,25 @@ export class ExpertBlameService {
|
||||
});
|
||||
}
|
||||
|
||||
async getUnifiedFileStatusReportV2(actor: any) {
|
||||
const rows = await this.collectBlamePortfolioDocs(actor);
|
||||
async getUnifiedFileStatusReportV2(
|
||||
actor: any,
|
||||
query: UnifiedFileStatusReportQueryDto = {},
|
||||
): Promise<UnifiedFileStatusReportDto> {
|
||||
let rows = await this.collectBlamePortfolioDocs(actor);
|
||||
const { fromDate, toDate } = parseListDateRange(query.from, query.to);
|
||||
rows = rows.filter((doc) =>
|
||||
isInListDateRange(
|
||||
(doc as { createdAt?: Date }).createdAt,
|
||||
fromDate,
|
||||
toDate,
|
||||
),
|
||||
);
|
||||
if (query.fileType) {
|
||||
rows = rows.filter(
|
||||
(doc) =>
|
||||
String((doc as { type?: string }).type ?? "") === query.fileType,
|
||||
);
|
||||
}
|
||||
const claimByPublicId = await this.loadClaimsByPublicIds(
|
||||
rows.map((d) => String((d as { publicId?: string }).publicId ?? "")),
|
||||
);
|
||||
@@ -590,6 +611,8 @@ export class ExpertBlameService {
|
||||
claimStatus: claim?.status,
|
||||
});
|
||||
},
|
||||
fileType: (doc) =>
|
||||
String((doc as { type?: string }).type ?? "") || undefined,
|
||||
searchExtras: (doc) => {
|
||||
const d = doc as {
|
||||
_id?: unknown;
|
||||
|
||||
Reference in New Issue
Block a user