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(
claimCase: any,
blame: any,
@@ -9967,12 +9962,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(