Fixed damagedParts unified structure and resend problems

This commit is contained in:
SepehrYahyaee
2026-06-03 11:34:21 +03:30
parent 456135ad08
commit 077bae429e
6 changed files with 154 additions and 95 deletions

View File

@@ -143,6 +143,7 @@ import {
} from "src/helpers/claim-capture-phase";
import { HttpService } from "@nestjs/axios";
import { firstValueFrom } from "rxjs";
import { buildEnrichedDamagedParts } from "src/expert-claim/dto/claim-damaged-part.enricher";
@Injectable()
export class ClaimRequestManagementService {
@@ -4660,7 +4661,7 @@ export class ClaimRequestManagementService {
"money.sheba": shebaNumber,
"money.nationalCodeOfInsurer": nationalCode,
status: ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
status: ClaimCaseStatus.CAPTURING_PART_DAMAGES,
"workflow.currentStep": ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
"workflow.nextStep": ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
@@ -6074,6 +6075,9 @@ export class ClaimRequestManagementService {
"workflow.nextStep": ClaimWorkflowStep.EXPERT_COST_EVALUATION,
"evaluation.objection": objectionPayload,
"damage.selectedParts": mergedNorm,
...(pendingResendGate && {
"evaluation.damageExpertResend.fulfilledAt": new Date(),
}),
},
$unset: {
"evaluation.ownerPricedPartsApproval": "",
@@ -6657,24 +6661,15 @@ export class ClaimRequestManagementService {
}
}
const damagedParts = displayParts.map((sp, index) => {
const ck = sp.catalogKey ?? catalogLikeKeyFromPart(sp);
const cap = getDamagedPartCaptureBlob(
damagedPartsData,
ck,
selectedNormDetails,
) as { url?: string; path?: string; fileName?: string } | undefined;
return {
index,
id: sp.id,
name: sp.name,
side: sp.side,
label_fa: sp.label_fa,
captured: !!cap,
url: cap?.url || (cap?.path ? buildFileLink(cap.path) : undefined),
...(cap?.path ? { path: cap.path } : {}),
...(cap?.fileName ? { fileName: cap.fileName } : {}),
};
const damagedParts = buildEnrichedDamagedParts({
selectedParts: displayParts,
damagedPartsData: damagedPartsData,
evaluationBlock: (claim as any).evaluation,
expertAddedParts: (claim.damage as any)?.expertAddedParts ?? [],
getDamagedPartCaptureBlob,
hasDamagedPartCapture,
catalogLikeKeyFromPart,
buildFileLink,
});
const er = claim.evaluation?.damageExpertResend;