forked from Yara724/api
Fix v5 + Fix ToDate field for damaged parts
This commit is contained in:
@@ -18,6 +18,7 @@ import { basename, resolve } from "node:path";
|
||||
import FormData = require("form-data");
|
||||
import { AiService } from "src/ai/ai.service";
|
||||
import { buildFileLink, resolveStoredFileUrl } from "src/helpers/urlCreator";
|
||||
import { jalaliToGregorianDate } from "src/helpers/date-jalali";
|
||||
import { RequestManagementDbService } from "src/request-management/entities/db-service/request-management.db.service";
|
||||
import { ReqBlameStatus } from "src/Types&Enums/blame-request-management/status.enum";
|
||||
import { ReqClaimStatus } from "src/Types&Enums/claim-request-management/status.enum";
|
||||
@@ -577,6 +578,8 @@ export class ClaimRequestManagementService {
|
||||
async getOuterPartsCatalogV2(): Promise<OuterPartCatalogItemDto[]> {
|
||||
const clientKey = resolveFanavaranClientKey();
|
||||
const rows = await this.getFanavaranLookupRows(clientKey, "car-components");
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
return rows
|
||||
.filter(
|
||||
(r): r is { Id: number; Caption: string } =>
|
||||
@@ -585,6 +588,13 @@ export class ClaimRequestManagementService {
|
||||
typeof (r as any).Id === "number" &&
|
||||
typeof (r as any).Caption === "string",
|
||||
)
|
||||
.filter((r) => {
|
||||
const toDate = (r as any).ToDate;
|
||||
if (!toDate) return true;
|
||||
const gregorian = jalaliToGregorianDate(String(toDate));
|
||||
if (!gregorian) return true;
|
||||
return new Date(gregorian) >= today;
|
||||
})
|
||||
.map((r) => ({ id: r.Id, label_fa: r.Caption }));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user