forked from Yara724/api
Merge pull request 'FIX v5 flow' (#193) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#193
This commit is contained in:
@@ -8139,7 +8139,7 @@ export class ClaimRequestManagementService {
|
||||
file: Express.Multer.File,
|
||||
currentUserId: string,
|
||||
actor?: { sub: string; role?: string },
|
||||
options?: { v3InPersonFlow?: boolean; skipMetalPlate?: boolean },
|
||||
options?: { v3InPersonFlow?: boolean; skipMetalPlate?: boolean; requiresFileMakerApproval?: boolean },
|
||||
): Promise<UploadRequiredDocumentV2ResponseDto> {
|
||||
try {
|
||||
const claimCase = await this.claimCaseDbService.findById(claimRequestId);
|
||||
@@ -8334,16 +8334,37 @@ export class ClaimRequestManagementService {
|
||||
progressAfterDoc.capturePhaseDocsComplete
|
||||
) {
|
||||
captureStepCompletedOnThisUpload = true;
|
||||
$set["status"] = ClaimCaseStatus.UPLOADING_REQUIRED_DOCUMENTS;
|
||||
$set["workflow.currentStep"] =
|
||||
ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS;
|
||||
$set["workflow.nextStep"] = options?.v3InPersonFlow
|
||||
? ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS
|
||||
: ClaimWorkflowStep.USER_SUBMISSION_COMPLETE;
|
||||
|
||||
if (options?.v3InPersonFlow) {
|
||||
// V4/V5: no further upload steps after capture docs — finalise now.
|
||||
const finalStatus = options.requiresFileMakerApproval
|
||||
? ClaimCaseStatus.WAITING_FOR_FILE_MAKER_APPROVAL
|
||||
: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT;
|
||||
$set["status"] = finalStatus;
|
||||
$set["claimStatus"] = ClaimStatus.PENDING;
|
||||
$set["workflow.currentStep"] = ClaimWorkflowStep.USER_SUBMISSION_COMPLETE;
|
||||
$set["workflow.nextStep"] = ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT;
|
||||
|
||||
// Mark the linked blame as COMPLETED.
|
||||
if (claimCase.blameRequestId) {
|
||||
await this.blameRequestDbService.findByIdAndUpdate(
|
||||
String(claimCase.blameRequestId),
|
||||
{ $set: { status: BlameCaseStatus.COMPLETED } },
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$set["status"] = ClaimCaseStatus.UPLOADING_REQUIRED_DOCUMENTS;
|
||||
$set["workflow.currentStep"] =
|
||||
ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS;
|
||||
$set["workflow.nextStep"] = ClaimWorkflowStep.USER_SUBMISSION_COMPLETE;
|
||||
}
|
||||
|
||||
completedStepsEntries.push(
|
||||
ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
||||
);
|
||||
completedStepsEntries.push(
|
||||
ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
||||
);
|
||||
historyEntries.push({
|
||||
type: "STEP_COMPLETED",
|
||||
actor: {
|
||||
@@ -8354,8 +8375,9 @@ export class ClaimRequestManagementService {
|
||||
timestamp: new Date(),
|
||||
metadata: {
|
||||
stepKey: ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
||||
description:
|
||||
"Angles, damaged parts, and capture-phase vehicle evidence (chassis, engine, metal plate) are complete. Please upload remaining required documents.",
|
||||
description: options?.v3InPersonFlow
|
||||
? "V4/V5 capture complete. Claim ready for review."
|
||||
: "Angles, damaged parts, and capture-phase vehicle evidence are complete.",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -10367,7 +10389,7 @@ export class ClaimRequestManagementService {
|
||||
file,
|
||||
currentUserId,
|
||||
actor,
|
||||
{ v3InPersonFlow: true, skipMetalPlate },
|
||||
{ v3InPersonFlow: true, skipMetalPlate, requiresFileMakerApproval: !!(claimCase as any).requiresFileMakerApproval },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user