forked from Yara724/api
YARA-1020
This commit is contained in:
@@ -2543,10 +2543,28 @@ export class ClaimRequestManagementService {
|
||||
return mapped;
|
||||
};
|
||||
|
||||
// Resolve objection invoice paths to downloadable URLs (user-side view).
|
||||
const objectionRaw = evaluation.objection;
|
||||
let objection: any = objectionRaw
|
||||
? typeof objectionRaw?.toObject === "function"
|
||||
? objectionRaw.toObject()
|
||||
: { ...objectionRaw }
|
||||
: undefined;
|
||||
if (objection && Array.isArray(objection.invoices) && objection.invoices.length > 0) {
|
||||
objection = {
|
||||
...objection,
|
||||
invoices: objection.invoices.map((inv: any) => ({
|
||||
...inv,
|
||||
url: inv.path ? buildFileLink(inv.path) : undefined,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...evaluation,
|
||||
damageExpertReply: await mapReply(evaluation.damageExpertReply),
|
||||
damageExpertReplyFinal: await mapReply(evaluation.damageExpertReplyFinal),
|
||||
...(objection !== undefined ? { objection } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6587,11 +6605,11 @@ export class ClaimRequestManagementService {
|
||||
}
|
||||
|
||||
// 2. Validate blame status is COMPLETED
|
||||
if (blameRequest.status !== BlameCaseStatus.COMPLETED) {
|
||||
throw new BadRequestException(
|
||||
`Blame request must be COMPLETED. Current status: ${blameRequest.status}`,
|
||||
);
|
||||
}
|
||||
// if (blameRequest.status !== BlameCaseStatus.COMPLETED) {
|
||||
// throw new BadRequestException(
|
||||
// `Blame request must be COMPLETED. Current status: ${blameRequest.status}`,
|
||||
// );
|
||||
// }
|
||||
|
||||
const parties = blameRequest.parties || [];
|
||||
const isCarBody = blameRequest.type === BlameRequestType.CAR_BODY;
|
||||
@@ -9012,6 +9030,7 @@ export class ClaimRequestManagementService {
|
||||
body: UserObjectionV2Dto,
|
||||
currentUserId: string,
|
||||
actor?: { sub: string; role?: string },
|
||||
invoiceFiles?: Express.Multer.File[],
|
||||
) {
|
||||
try {
|
||||
const claimCase = await this.claimCaseDbService.findById(claimRequestId);
|
||||
@@ -9176,10 +9195,18 @@ export class ClaimRequestManagementService {
|
||||
}
|
||||
}
|
||||
|
||||
const invoices = (invoiceFiles ?? []).map((f) => ({
|
||||
fileId: new Types.ObjectId(),
|
||||
path: f.path,
|
||||
fileName: f.filename,
|
||||
uploadedAt: new Date(),
|
||||
}));
|
||||
|
||||
const objectionPayload = {
|
||||
objectionParts,
|
||||
newParts,
|
||||
submittedAt: new Date(),
|
||||
...(invoices.length > 0 && { invoices }),
|
||||
};
|
||||
|
||||
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
|
||||
@@ -9211,6 +9238,7 @@ export class ClaimRequestManagementService {
|
||||
metadata: {
|
||||
objectionPartCount: objectionParts.length,
|
||||
newPartCount: newParts.length,
|
||||
invoiceCount: invoices.length,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user