1
0
forked from Yara724/api

Fixed resendCarParts label_fa's + OTP

This commit is contained in:
SepehrYahyaee
2026-05-25 14:13:17 +03:30
parent 64fa560f73
commit 680f3c1798
10 changed files with 435 additions and 84 deletions

View File

@@ -114,6 +114,7 @@ import {
sanitizeDamageSelectedPartV2,
type DamageSelectedPartV2,
} from "src/helpers/outer-damage-parts";
import { normalizeResendCarPartsForStorage } from "src/helpers/claim-expert-resend";
import { ClaimVehicleTypeV2 } from "src/static/outer-car-parts-catalog";
import { snapshotFromDamageExpert } from "src/helpers/expert-profile-snapshot";
import { DamageExpertModel } from "src/users/entities/schema/damage-expert.schema";
@@ -2712,19 +2713,12 @@ export class ExpertClaimService {
}
const uniqueDocs = [...new Set(docs)];
const normalizedParts = (reply.resendCarParts ?? []).map((p) => {
const row: Record<string, unknown> = {
key: p.key,
label_fa: p.label_fa,
label_en: p.label_en,
captured: false,
};
const id = (p as { id?: number }).id;
if (typeof id === "number" && Number.isFinite(id)) {
row.id = Math.trunc(id);
}
return row;
});
const carType = claim.vehicle?.carType as ClaimVehicleTypeV2 | undefined;
const normalizedParts = normalizeResendCarPartsForStorage(
reply.resendCarParts,
carType,
claim.damage?.selectedParts,
);
const desc = String(reply.resendDescription ?? "").trim();
if (!desc && uniqueDocs.length === 0 && normalizedParts.length === 0) {