Fix v5 + Fix ToDate field for damaged parts

This commit is contained in:
SepehrYahyaee
2026-08-03 18:48:15 +03:30
parent 793dc52640
commit cb23455bcd
2 changed files with 42 additions and 2 deletions

View File

@@ -11081,6 +11081,9 @@ export class RequestManagementService {
: { ...(req as any) };
// Attach linked claim ID if present
const claim = await this.claimCaseDbService.findOne({ blameRequestId: (req as any)._id });
const claimPlain = claim && typeof (claim as any).toObject === "function"
? (claim as any).toObject({ versionKey: false })
: claim ? { ...(claim as any) } : null;
return {
_id: plain._id,
publicId: plain.publicId,
@@ -11115,7 +11118,19 @@ export class RequestManagementService {
inquiryComplete: !!(p.person?.inquiriesCompleted),
hasSigned: p.confirmation != null,
})),
linkedClaimId: claim ? String((claim as any)._id) : null,
linkedClaimId: claimPlain ? String(claimPlain._id) : null,
...(claimPlain ? {
claimStatus: claimPlain.status,
claimWorkflow: claimPlain.workflow,
fileMakerRejectionCount: claimPlain.fileMakerRejectionCount ?? 0,
fileMakerRejectionReason: claimPlain.fileMakerRejectionReason ?? null,
evaluation: claimPlain.evaluation
? {
damageExpertReply: claimPlain.evaluation.damageExpertReply ?? null,
damageExpertReplyFinal: claimPlain.evaluation.damageExpertReplyFinal ?? null,
}
: null,
} : {}),
createdAt: plain.createdAt,
updatedAt: plain.updatedAt,
};
@@ -11169,6 +11184,9 @@ export class RequestManagementService {
? (req as any).toObject({ versionKey: false })
: { ...(req as any) };
const claim = await this.claimCaseDbService.findOne({ blameRequestId: (req as any)._id });
const claimPlain = claim && typeof (claim as any).toObject === "function"
? (claim as any).toObject({ versionKey: false })
: claim ? { ...(claim as any) } : null;
return {
_id: plain._id,
publicId: plain.publicId,
@@ -11216,7 +11234,19 @@ export class RequestManagementService {
} : undefined,
accidentFields: plain.expert.accidentFields,
} : undefined,
linkedClaimId: claim ? String((claim as any)._id) : null,
linkedClaimId: claimPlain ? String(claimPlain._id) : null,
...(claimPlain ? {
claimStatus: claimPlain.status,
claimWorkflow: claimPlain.workflow,
fileMakerRejectionCount: claimPlain.fileMakerRejectionCount ?? 0,
fileMakerRejectionReason: claimPlain.fileMakerRejectionReason ?? null,
evaluation: claimPlain.evaluation
? {
damageExpertReply: claimPlain.evaluation.damageExpertReply ?? null,
damageExpertReplyFinal: claimPlain.evaluation.damageExpertReplyFinal ?? null,
}
: null,
} : {}),
createdAt: plain.createdAt,
updatedAt: plain.updatedAt,
};