From 4cf0461a483b79005293e5216a10f9e90fdba7f9 Mon Sep 17 00:00:00 2001 From: SepehrYahyaee <7heycallmegray@gmail.com> Date: Tue, 28 Jul 2026 14:57:17 +0330 Subject: [PATCH] YARA-1147 --- src/expert-claim/expert-claim.service.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/expert-claim/expert-claim.service.ts b/src/expert-claim/expert-claim.service.ts index 01a7db3..2cb4898 100644 --- a/src/expert-claim/expert-claim.service.ts +++ b/src/expert-claim/expert-claim.service.ts @@ -4148,12 +4148,14 @@ export class ExpertClaimService { /** * Claim list for FILE_REVIEWER. * - * Visibility rules: + * Visibility rules (both V4 and V5 files): * - WAITING_FOR_FILE_REVIEWER files made by a FileMaker that are either: * (a) not yet assigned to any reviewer, OR * (b) already assigned to THIS reviewer - * - WAITING_FOR_EXPERT files that are assigned to THIS reviewer - * (they completed the field work and the file is now in damage-expert queue) + * - Files already assigned to THIS reviewer (any post-assignment status) + * + * V4: isMadeByFileMaker=true, requiresFileMakerApproval=false + * V5: isMadeByFileMaker=true, requiresFileMakerApproval=true * * All scoped to this reviewer's insurance company via blame party clientId. */ @@ -4164,7 +4166,7 @@ export class ExpertClaimService { const clientKey = requireActorClientKey(actor); const reviewerOid = new Types.ObjectId(actor.sub); - // Find V4 blame files visible to this reviewer + // Find V4 and V5 blame files visible to this reviewer const blames = (await this.blameRequestDbService.find( { isMadeByFileMaker: true, @@ -4186,7 +4188,7 @@ export class ExpertClaimService { { lean: true, select: - "_id type parties blameStatus status expert.decision assignedFileReviewerId", + "_id type parties blameStatus status expert.decision assignedFileReviewerId requiresFileMakerApproval", }, )) as any[]; @@ -4262,8 +4264,9 @@ export class ExpertClaimService { } /** - * Claim list for FILE_MAKER โ€” returns only the claims linked to blame files - * they personally created (V4 flow). + * Claim list for FILE_MAKER โ€” returns claims linked to blame files they + * personally created (V4 and V5 flows). + * V4: requiresFileMakerApproval=false ยท V5: requiresFileMakerApproval=true */ private async getFileMakerClaimListV2( actor: any, @@ -4273,7 +4276,7 @@ export class ExpertClaimService { const makerBlames = (await this.blameRequestDbService.find( { isMadeByFileMaker: true, initiatedByFieldExpertId: makerOid }, - { lean: true, select: "_id type parties blameStatus status expert.decision assignedFileReviewerId" }, + { lean: true, select: "_id type parties blameStatus status expert.decision assignedFileReviewerId requiresFileMakerApproval" }, )) as any[]; if (makerBlames.length === 0) { @@ -4281,9 +4284,10 @@ export class ExpertClaimService { } const blameIds = makerBlames.map((b) => b._id); + // Include all claims linked to this maker's blames โ€” both V4 (requiresFileMakerApproval=false) + // and V5 (requiresFileMakerApproval=true). const claims = (await this.claimCaseDbService.find({ blameRequestId: { $in: blameIds }, - requiresFileMakerApproval: true, })) as any[]; const blameById = new Map(