1
0
forked from Yara724/api

daghi problem fixed , 2 apis for reporting counts added

This commit is contained in:
2026-04-21 16:43:15 +03:30
parent a3156881b8
commit 75b7e5ecad
6 changed files with 144 additions and 4 deletions

View File

@@ -39,6 +39,10 @@ import {
claimCaseTouchesClient,
requireActorClientKey,
} from "src/helpers/tenant-scope";
import {
claimCaseStatusToReportBucket,
initialClaimExpertReportBuckets,
} from "src/helpers/expert-panel-status-report";
import { ClaimWorkflowStep } from "src/Types&Enums/claim-request-management/claim-workflow-steps.enum";
import { BlameRequestType } from "src/Types&Enums/blame-request-management/blameRequestType.enum";
import { PartyRole } from "src/request-management/entities/schema/partyRole.enum";
@@ -2448,6 +2452,25 @@ export class ExpertClaimService {
};
}
/**
* V2: Count claim cases for this damage experts tenant, grouped for dashboard:
* `IN_PROGRESS` = user flow before submission complete (CREATED … CAPTURING_PART_DAMAGES);
* other {@link ClaimCaseStatus} keys unchanged.
*/
async getStatusReportBucketsV2(actor: any): Promise<Record<string, number>> {
const clientKey = requireActorClientKey(actor);
const rows = await this.claimCaseDbService.find({}, { lean: true });
const buckets = initialClaimExpertReportBuckets();
for (const doc of rows as Record<string, unknown>[]) {
if (!claimCaseTouchesClient(doc, clientKey)) continue;
const st = String(doc.status ?? "");
const key = claimCaseStatusToReportBucket(st);
buckets.all++;
buckets[key] = (buckets[key] ?? 0) + 1;
}
return buckets;
}
/**
* V2: Get claim list for damage expert
*