1
0
forked from Yara724/api

Merge pull request 'Fixed outer parts flow bug in v4' (#172) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#172
This commit is contained in:
2026-07-04 10:29:10 +03:30

View File

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