Merge pull request 'YARA-1169' (#269) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#269
This commit is contained in:
2026-08-16 10:59:31 +03:30
2 changed files with 48 additions and 2 deletions

View File

@@ -11374,6 +11374,7 @@ export class ClaimRequestManagementService {
step === ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS &&
capturePartDone
) {
// car-capture not yet uploaded: next step is the walk-around video.
return {
...base,
requiredDocuments: [],
@@ -11384,6 +11385,22 @@ export class ClaimRequestManagementService {
};
}
// V3 FIELD_EXPERT only: car-capture is done (step advanced to USER_SUBMISSION_COMPLETE
// in setVideoCaptureV3). The one remaining action is the blame accident video.
if (
step === ClaimWorkflowStep.USER_SUBMISSION_COMPLETE &&
!(blame as any).isMadeByFileMaker
) {
return {
...base,
requiredDocuments: [],
captureSequencePhase: "complete",
captureSequenceHint:
"Walk-around video uploaded. Upload the blame accident video to finalise.",
totalRemaining: 0,
};
}
return base;
}
@@ -11721,7 +11738,34 @@ export class ClaimRequestManagementService {
// 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) {
// Advance the workflow step so that if the expert exits and reopens the claim
// the system correctly resumes at upload-video rather than replaying car-capture.
if (!(blame as any).isMadeByFileMaker) {
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
$set: {
"workflow.currentStep": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
"workflow.nextStep": undefined,
},
$push: {
"workflow.completedSteps": ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
history: {
type: "STEP_COMPLETED",
actor: {
actorId: new Types.ObjectId(currentUserId),
actorName: claimCase.owner?.fullName || "User",
actorType: "field_expert",
},
timestamp: new Date(),
metadata: {
stepKey: ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
description:
"V3 walk-around video uploaded. Upload blame accident video to finalise.",
v3InPersonFlow: true,
},
},
},
});
} else 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.

View File

@@ -10049,7 +10049,9 @@ export class RequestManagementService {
}
if (
claim.workflow?.currentStep !==
ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS
ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS &&
claim.workflow?.currentStep !==
ClaimWorkflowStep.USER_SUBMISSION_COMPLETE
) {
throw new BadRequestException(
"Complete capture-part (parts, angles, and capture-phase documents) before the blame accident video.",