YARA-1209, YARA-1214

This commit is contained in:
SepehrYahyaee
2026-08-09 10:21:12 +03:30
parent 26da533a52
commit 473075e546
3 changed files with 76 additions and 7 deletions

View File

@@ -8308,8 +8308,14 @@ export class ClaimRequestManagementService {
);
}
// 4. Validate outer parts haven't been selected yet
// 4. Validate outer parts haven't been selected yet.
// For FILE_REVIEWER re-reviewing after a FileMaker rejection, the existing
// selection from the prior cycle is intentionally overwritten — skip this
// guard so the reviewer can update the damaged parts list.
const isFileReviewerReselect =
actor?.role === RoleEnum.FILE_REVIEWER;
if (
!isFileReviewerReselect &&
claimCase.damage?.selectedParts &&
claimCase.damage.selectedParts.length > 0
) {
@@ -11161,10 +11167,21 @@ export class ClaimRequestManagementService {
// USER_SUBMISSION_COMPLETE: can occur when documents were uploaded via a
// non-V3 path (e.g. generic v2 endpoint). Safe to advance as long as
// accident fields are set (checked just below).
// EXPERT_REVIEWING + EXPERT_DAMAGE_ASSESSMENT: FileReviewer re-entering
// after a FileMaker rejection. The claim was locked back to
// EXPERT_REVIEWING by the reviewer's lock call; the document phase was
// already completed in the prior cycle so it's safe to advance directly
// to part selection.
const isFileReviewerReentry =
claimCase.status === ClaimCaseStatus.EXPERT_REVIEWING &&
step === ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT &&
(blame as any)?.isMadeByFileMaker === true;
const canAdvance =
step === ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS ||
step === ClaimWorkflowStep.USER_SUBMISSION_COMPLETE ||
claimCase.status === ClaimCaseStatus.WAITING_FOR_FILE_REVIEWER;
claimCase.status === ClaimCaseStatus.WAITING_FOR_FILE_REVIEWER ||
isFileReviewerReentry;
if (!canAdvance) {
throw new BadRequestException(
@@ -11574,9 +11591,19 @@ export class ClaimRequestManagementService {
throw new BadRequestException("Video file is required.");
}
if (claimCase.media?.videoCaptureId) {
throw new ConflictException(
"A walk-around video has already been uploaded for this claim.",
);
// FILE_REVIEWER re-reviewing after a FileMaker rejection: allow replacing
// the previous walk-around video by clearing the stale id first so that
// setVideoCaptureV2's own conflict check doesn't block the upload.
if (actor?.role === RoleEnum.FILE_REVIEWER) {
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
$unset: { "media.videoCaptureId": "" },
});
claimCase.media = { ...(claimCase.media ?? {}), videoCaptureId: undefined } as any;
} else {
throw new ConflictException(
"A walk-around video has already been uploaded for this claim.",
);
}
}
if (