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; 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({ @ApiPropertyOptional({
description: description:
"Slice of `claim.evaluation` exposed to the damage expert. " + "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`.", "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; 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 { export class GetClaimListV2ResponseDto {

View File

@@ -4309,6 +4309,7 @@ export class ExpertClaimService {
blameRequestId: c.blameRequestId?.toString(), blameRequestId: c.blameRequestId?.toString(),
createdAt: c.createdAt, createdAt: c.createdAt,
awaitingFactorValidation: claimIsAwaitingExpertFactorValidationV2(c), awaitingFactorValidation: claimIsAwaitingExpertFactorValidationV2(c),
requiresFileMakerApproval: !!(c as any).requiresFileMakerApproval,
needsFileReviewerCompletion: needsFileReviewerCompletion:
String(blame?.status ?? "") === "WAITING_FOR_FILE_REVIEWER" || String(blame?.status ?? "") === "WAITING_FOR_FILE_REVIEWER" ||
(!!blame?.isMadeByFileMaker && (!!blame?.isMadeByFileMaker &&
@@ -5039,6 +5040,7 @@ export class ExpertClaimService {
carAngles, carAngles,
damagedParts, damagedParts,
awaitingFactorValidation: isFactorValidationPending, awaitingFactorValidation: isFactorValidationPending,
requiresFileMakerApproval: !!(claim as any).requiresFileMakerApproval,
evaluation: evaluation:
(evaluationForApi as (evaluationForApi as
| ClaimDetailV2ResponseDto["evaluation"] | 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: [ history: [
{ {
type: "CLAIM_CREATED", type: "CLAIM_CREATED",
@@ -9816,19 +9824,15 @@ export class RequestManagementService {
} }
await (req as any).save(); await (req as any).save();
// Advance the claim into the damage-expert queue AND mark FileMaker approval // Advance the claim into the damage-expert queue.
// required before fanavaran submission. // requiresFileMakerApproval / fileMakerApprovalActorId were already set at
const fileMakerActorId = req.initiatedByFieldExpertId ?? null; // claim creation time (createV3ClaimFromBlame) so no need to repeat here.
await this.claimCaseDbService.findByIdAndUpdate(String(claim._id), { await this.claimCaseDbService.findByIdAndUpdate(String(claim._id), {
$set: { $set: {
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT, status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
claimStatus: ClaimStatus.PENDING, claimStatus: ClaimStatus.PENDING,
"workflow.currentStep": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE, "workflow.currentStep": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT, "workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
requiresFileMakerApproval: true,
...(fileMakerActorId
? { fileMakerApprovalActorId: new Types.ObjectId(String(fileMakerActorId)) }
: {}),
}, },
$push: { $push: {
"workflow.completedSteps": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE, "workflow.completedSteps": ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
@@ -9845,7 +9849,6 @@ export class RequestManagementService {
description: description:
"V5 field workflow complete. Claim ready for damage expert review (FileMaker approval required before fanavaran).", "V5 field workflow complete. Claim ready for damage expert review (FileMaker approval required before fanavaran).",
v5InPersonFlow: true, v5InPersonFlow: true,
fileMakerActorId: fileMakerActorId ? String(fileMakerActorId) : null,
}, },
}, },
}, },