1
0
forked from Yara724/api

Fixed outer parts flow bug in v4

This commit is contained in:
2026-07-04 10:28:20 +03:30
parent 9e2cf9bcdf
commit 7641c56440

View File

@@ -9880,11 +9880,6 @@ export class ClaimRequestManagementService {
}
}
private v3PartsFlowNotStarted(claimCase: any): boolean {
const parts = claimCase.damage?.selectedParts;
return !Array.isArray(parts) || parts.length === 0;
}
private async advanceV3ClaimToOuterPartsIfReady(
claimCase: any,
blame: any,
@@ -9896,12 +9891,13 @@ export class ClaimRequestManagementService {
}
const step = claimCase.workflow?.currentStep;
const partsNotStarted = this.v3PartsFlowNotStarted(claimCase);
const prematurelyCompleted =
step === ClaimWorkflowStep.USER_SUBMISSION_COMPLETE && partsNotStarted;
// USER_SUBMISSION_COMPLETE can occur when documents were uploaded via a
// non-V3 path (e.g. generic v2 endpoint). As long as accident fields are
// set (checked just below), it is safe to advance to SELECT_OUTER_PARTS.
// The duplicate-selection guard lives in selectOuterPartsV2 itself.
const canAdvance =
step === ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS ||
prematurelyCompleted;
step === ClaimWorkflowStep.USER_SUBMISSION_COMPLETE;
if (!canAdvance) {
throw new BadRequestException(