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