1
0
forked from Yara724/api

Merge pull request 'Fixed file maker retrieving files' (#190) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#190
This commit is contained in:
2026-07-14 14:31:20 +03:30
4 changed files with 27 additions and 8 deletions

View File

@@ -131,6 +131,13 @@ export class ClaimDetailV2ResponseDto {
})
awaitingFactorValidation?: boolean;
@ApiPropertyOptional({
description:
"True for V5 files — the FileMaker must approve or reject the claim before it is submitted to fanavaran. False (or absent) for V4 files which go straight through.",
example: true,
})
requiresFileMakerApproval?: boolean;
@ApiPropertyOptional({
description:
"Slice of `claim.evaluation` exposed to the damage expert. " +

View File

@@ -70,6 +70,13 @@ export class ClaimListItemV2Dto {
"True in the expert repair-factor validation queue: `status=EXPERT_VALIDATING_REPAIR_FACTORS` (or legacy `WAITING_FOR_INSURER_APPROVAL`) with `claimStatus=UNDER_REVIEW` and `currentStep=EXPERT_COST_EVALUATION`.",
})
awaitingFactorValidation?: boolean;
@ApiPropertyOptional({
description:
"True for V5 files — the FileMaker must approve or reject the claim before it is submitted to fanavaran. False (or absent) for V4 files which go straight through.",
example: true,
})
requiresFileMakerApproval?: boolean;
}
export class GetClaimListV2ResponseDto {

View File

@@ -4309,6 +4309,7 @@ export class ExpertClaimService {
blameRequestId: c.blameRequestId?.toString(),
createdAt: c.createdAt,
awaitingFactorValidation: claimIsAwaitingExpertFactorValidationV2(c),
requiresFileMakerApproval: !!(c as any).requiresFileMakerApproval,
needsFileReviewerCompletion:
String(blame?.status ?? "") === "WAITING_FOR_FILE_REVIEWER" ||
(!!blame?.isMadeByFileMaker &&
@@ -5039,6 +5040,7 @@ export class ExpertClaimService {
carAngles,
damagedParts,
awaitingFactorValidation: isFactorValidationPending,
requiresFileMakerApproval: !!(claim as any).requiresFileMakerApproval,
evaluation:
(evaluationForApi as
| ClaimDetailV2ResponseDto["evaluation"]

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,
},
},
},