YARA-1147

This commit is contained in:
SepehrYahyaee
2026-07-28 14:57:17 +03:30
parent d7e6784746
commit 4cf0461a48

View File

@@ -4148,12 +4148,14 @@ export class ExpertClaimService {
/** /**
* Claim list for FILE_REVIEWER. * 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: * - WAITING_FOR_FILE_REVIEWER files made by a FileMaker that are either:
* (a) not yet assigned to any reviewer, OR * (a) not yet assigned to any reviewer, OR
* (b) already assigned to THIS reviewer * (b) already assigned to THIS reviewer
* - WAITING_FOR_EXPERT files that are assigned to THIS reviewer * - Files already assigned to THIS reviewer (any post-assignment status)
* (they completed the field work and the file is now in damage-expert queue) *
* V4: isMadeByFileMaker=true, requiresFileMakerApproval=false
* V5: isMadeByFileMaker=true, requiresFileMakerApproval=true
* *
* All scoped to this reviewer's insurance company via blame party clientId. * All scoped to this reviewer's insurance company via blame party clientId.
*/ */
@@ -4164,7 +4166,7 @@ export class ExpertClaimService {
const clientKey = requireActorClientKey(actor); const clientKey = requireActorClientKey(actor);
const reviewerOid = new Types.ObjectId(actor.sub); 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( const blames = (await this.blameRequestDbService.find(
{ {
isMadeByFileMaker: true, isMadeByFileMaker: true,
@@ -4186,7 +4188,7 @@ export class ExpertClaimService {
{ {
lean: true, lean: true,
select: select:
"_id type parties blameStatus status expert.decision assignedFileReviewerId", "_id type parties blameStatus status expert.decision assignedFileReviewerId requiresFileMakerApproval",
}, },
)) as any[]; )) as any[];
@@ -4262,8 +4264,9 @@ export class ExpertClaimService {
} }
/** /**
* Claim list for FILE_MAKER — returns only the claims linked to blame files * Claim list for FILE_MAKER — returns claims linked to blame files they
* they personally created (V4 flow). * personally created (V4 and V5 flows).
* V4: requiresFileMakerApproval=false · V5: requiresFileMakerApproval=true
*/ */
private async getFileMakerClaimListV2( private async getFileMakerClaimListV2(
actor: any, actor: any,
@@ -4273,7 +4276,7 @@ export class ExpertClaimService {
const makerBlames = (await this.blameRequestDbService.find( const makerBlames = (await this.blameRequestDbService.find(
{ isMadeByFileMaker: true, initiatedByFieldExpertId: makerOid }, { 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[]; )) as any[];
if (makerBlames.length === 0) { if (makerBlames.length === 0) {
@@ -4281,9 +4284,10 @@ export class ExpertClaimService {
} }
const blameIds = makerBlames.map((b) => b._id); 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({ const claims = (await this.claimCaseDbService.find({
blameRequestId: { $in: blameIds }, blameRequestId: { $in: blameIds },
requiresFileMakerApproval: true,
})) as any[]; })) as any[];
const blameById = new Map<string, any>( const blameById = new Map<string, any>(