forked from Yara724/api
YARA-1147
This commit is contained in:
@@ -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<string, any>(
|
||||
|
||||
Reference in New Issue
Block a user