forked from Yara724/api
FIX v5 flow
This commit is contained in:
@@ -8139,7 +8139,7 @@ export class ClaimRequestManagementService {
|
|||||||
file: Express.Multer.File,
|
file: Express.Multer.File,
|
||||||
currentUserId: string,
|
currentUserId: string,
|
||||||
actor?: { sub: string; role?: string },
|
actor?: { sub: string; role?: string },
|
||||||
options?: { v3InPersonFlow?: boolean; skipMetalPlate?: boolean },
|
options?: { v3InPersonFlow?: boolean; skipMetalPlate?: boolean; requiresFileMakerApproval?: boolean },
|
||||||
): Promise<UploadRequiredDocumentV2ResponseDto> {
|
): Promise<UploadRequiredDocumentV2ResponseDto> {
|
||||||
try {
|
try {
|
||||||
const claimCase = await this.claimCaseDbService.findById(claimRequestId);
|
const claimCase = await this.claimCaseDbService.findById(claimRequestId);
|
||||||
@@ -8334,16 +8334,37 @@ export class ClaimRequestManagementService {
|
|||||||
progressAfterDoc.capturePhaseDocsComplete
|
progressAfterDoc.capturePhaseDocsComplete
|
||||||
) {
|
) {
|
||||||
captureStepCompletedOnThisUpload = true;
|
captureStepCompletedOnThisUpload = true;
|
||||||
$set["status"] = ClaimCaseStatus.UPLOADING_REQUIRED_DOCUMENTS;
|
|
||||||
$set["workflow.currentStep"] =
|
if (options?.v3InPersonFlow) {
|
||||||
ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS;
|
// V4/V5: no further upload steps after capture docs — finalise now.
|
||||||
$set["workflow.nextStep"] = options?.v3InPersonFlow
|
const finalStatus = options.requiresFileMakerApproval
|
||||||
? ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS
|
? ClaimCaseStatus.WAITING_FOR_FILE_MAKER_APPROVAL
|
||||||
: ClaimWorkflowStep.USER_SUBMISSION_COMPLETE;
|
: 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(
|
completedStepsEntries.push(
|
||||||
ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
||||||
);
|
);
|
||||||
|
completedStepsEntries.push(
|
||||||
|
ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
||||||
|
);
|
||||||
historyEntries.push({
|
historyEntries.push({
|
||||||
type: "STEP_COMPLETED",
|
type: "STEP_COMPLETED",
|
||||||
actor: {
|
actor: {
|
||||||
@@ -8354,8 +8375,9 @@ export class ClaimRequestManagementService {
|
|||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
metadata: {
|
metadata: {
|
||||||
stepKey: ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
stepKey: ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
||||||
description:
|
description: options?.v3InPersonFlow
|
||||||
"Angles, damaged parts, and capture-phase vehicle evidence (chassis, engine, metal plate) are complete. Please upload remaining required documents.",
|
? "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,
|
file,
|
||||||
currentUserId,
|
currentUserId,
|
||||||
actor,
|
actor,
|
||||||
{ v3InPersonFlow: true, skipMetalPlate },
|
{ v3InPersonFlow: true, skipMetalPlate, requiresFileMakerApproval: !!(claimCase as any).requiresFileMakerApproval },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user