forked from Yara724/api
Fixed v3 mirror flow
This commit is contained in:
@@ -10598,42 +10598,46 @@ export class ClaimRequestManagementService {
|
|||||||
actor,
|
actor,
|
||||||
);
|
);
|
||||||
|
|
||||||
// V4/V5 (in-person FileReviewer flow): car-capture is the last step.
|
// V4/V5 only (isMadeByFileMaker): car-capture is the FINAL FileReviewer step.
|
||||||
// Both variants land at WAITING_FOR_DAMAGE_EXPERT here.
|
// For the v3 mirror (FIELD_EXPERT IN_PERSON), car-capture is penultimate —
|
||||||
// For V5 (requiresFileMakerApproval=true), autoSubmitToFanavaranV2OnClaimCompleted
|
// expertUploadBlameVideoV3 finalises the blame with the accident video next.
|
||||||
// intercepts COMPLETED → WAITING_FOR_FILE_MAKER_APPROVAL after expert review.
|
if ((blame as any).isMadeByFileMaker) {
|
||||||
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
|
// Both V4 and V5 land at WAITING_FOR_DAMAGE_EXPERT here.
|
||||||
$set: {
|
// For V5 (requiresFileMakerApproval=true), autoSubmitToFanavaranV2OnClaimCompleted
|
||||||
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
|
// intercepts COMPLETED → WAITING_FOR_FILE_MAKER_APPROVAL after expert review.
|
||||||
claimStatus: ClaimStatus.PENDING,
|
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
|
||||||
"workflow.currentStep": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
$set: {
|
||||||
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
|
||||||
},
|
claimStatus: ClaimStatus.PENDING,
|
||||||
$push: {
|
"workflow.currentStep": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
||||||
"workflow.completedSteps": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
||||||
history: {
|
},
|
||||||
type: "STEP_COMPLETED",
|
$push: {
|
||||||
actor: {
|
"workflow.completedSteps": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
||||||
actorId: new Types.ObjectId(currentUserId),
|
history: {
|
||||||
actorName: claimCase.owner?.fullName || "User",
|
type: "STEP_COMPLETED",
|
||||||
actorType: actor?.role === RoleEnum.FILE_REVIEWER ? "file_reviewer" : "user",
|
actor: {
|
||||||
},
|
actorId: new Types.ObjectId(currentUserId),
|
||||||
timestamp: new Date(),
|
actorName: claimCase.owner?.fullName || "User",
|
||||||
metadata: {
|
actorType: actor?.role === RoleEnum.FILE_REVIEWER ? "file_reviewer" : "user",
|
||||||
stepKey: ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
},
|
||||||
description: "V4/V5 walk-around video uploaded. Claim ready for damage expert review.",
|
timestamp: new Date(),
|
||||||
v3InPersonFlow: true,
|
metadata: {
|
||||||
|
stepKey: ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
||||||
|
description: "V4/V5 walk-around video uploaded. Claim ready for damage expert review.",
|
||||||
|
v3InPersonFlow: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Mark the linked blame file as COMPLETED.
|
// Mark the linked blame file as COMPLETED.
|
||||||
if (claimCase.blameRequestId) {
|
if (claimCase.blameRequestId) {
|
||||||
await this.blameRequestDbService.findByIdAndUpdate(
|
await this.blameRequestDbService.findByIdAndUpdate(
|
||||||
String(claimCase.blameRequestId),
|
String(claimCase.blameRequestId),
|
||||||
{ $set: { status: BlameCaseStatus.COMPLETED } },
|
{ $set: { status: BlameCaseStatus.COMPLETED } },
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user