Fixed file maker retrieving files

This commit is contained in:
SepehrYahyaee
2026-07-14 14:30:41 +03:30
parent aec9e76918
commit 385757c3a0
4 changed files with 27 additions and 8 deletions

View File

@@ -8814,6 +8814,14 @@ export class RequestManagementService {
},
}
: {}),
// V5 (isMadeByFileMaker): mark approval gate at claim creation so the flag
// is always present regardless of whether upload-video is called.
...((req as any).isMadeByFileMaker
? {
requiresFileMakerApproval: true,
fileMakerApprovalActorId: new Types.ObjectId(actor.sub),
}
: {}),
history: [
{
type: "CLAIM_CREATED",
@@ -9816,19 +9824,15 @@ export class RequestManagementService {
}
await (req as any).save();
// Advance the claim into the damage-expert queue AND mark FileMaker approval
// required before fanavaran submission.
const fileMakerActorId = req.initiatedByFieldExpertId ?? null;
// Advance the claim into the damage-expert queue.
// requiresFileMakerApproval / fileMakerApprovalActorId were already set at
// claim creation time (createV3ClaimFromBlame) so no need to repeat here.
await this.claimCaseDbService.findByIdAndUpdate(String(claim._id), {
$set: {
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
claimStatus: ClaimStatus.PENDING,
"workflow.currentStep": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
requiresFileMakerApproval: true,
...(fileMakerActorId
? { fileMakerApprovalActorId: new Types.ObjectId(String(fileMakerActorId)) }
: {}),
},
$push: {
"workflow.completedSteps": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
@@ -9845,7 +9849,6 @@ export class RequestManagementService {
description:
"V5 field workflow complete. Claim ready for damage expert review (FileMaker approval required before fanavaran).",
v5InPersonFlow: true,
fileMakerActorId: fileMakerActorId ? String(fileMakerActorId) : null,
},
},
},