1
0
forked from Yara724/api

YARA-1072

This commit is contained in:
SepehrYahyaee
2026-06-28 15:04:18 +03:30
parent d3249e9854
commit 220b39ea5a

View File

@@ -378,7 +378,10 @@ export class ExpertClaimService {
return this.blameRequestDbService.findById(id);
}
private async assertExpertActorOnClaim(claim: any, actor: any): Promise<void> {
private async assertExpertActorOnClaim(
claim: any,
actor: any,
): Promise<void> {
const blame = await this.loadBlameForClaim(claim);
assertClaimCaseForExpertActor(claim, actor, blame);
}
@@ -2462,9 +2465,15 @@ export class ExpertClaimService {
*/
async assignClaimForReviewV2(
claimRequestId: string,
actor: { sub: string; fullName?: string; clientKey?: string; role?: string },
actor: {
sub: string;
fullName?: string;
clientKey?: string;
role?: string;
},
): Promise<ExpertFileAssignResultDto> {
if ((actor as any).role !== RoleEnum.FIELD_EXPERT) requireActorClientKey(actor);
if ((actor as any).role !== RoleEnum.FIELD_EXPERT)
requireActorClientKey(actor);
await this.expireClaimWorkflowLockV2IfStale(claimRequestId);
const claim = await this.claimCaseDbService.findById(claimRequestId);
@@ -3003,7 +3012,9 @@ export class ExpertClaimService {
if (priceCap !== null) {
let totalPrice = 0;
for (const part of reply.parts || []) {
const parsed = this.parsePersianNumber(String(part.totalPayment ?? "0"));
const parsed = this.parsePersianNumber(
String(part.totalPayment ?? "0"),
);
if (!isNaN(parsed)) totalPrice += parsed;
}
if (totalPrice > priceCap) {
@@ -3492,7 +3503,8 @@ export class ExpertClaimService {
const clientKey = requireActorClientKey(actor);
const expertId = String(actor.sub);
const expertOid = new Types.ObjectId(expertId);
const activityEvents = await this.expertFileActivityDbService.findByExpert(
const activityEvents =
await this.expertFileActivityDbService.findByExpert(
expertId,
ExpertFileKind.CLAIM,
);
@@ -3511,7 +3523,10 @@ export class ExpertClaimService {
const rows =
orClauses.length === 0
? []
: await this.claimCaseDbService.find({ $or: orClauses }, { lean: true });
: await this.claimCaseDbService.find(
{ $or: orClauses },
{ lean: true },
);
const seen = new Set<string>();
for (const doc of rows as Record<string, unknown>[]) {
const id = String(doc._id ?? "");
@@ -4513,9 +4528,10 @@ export class ExpertClaimService {
carAngles,
damagedParts,
awaitingFactorValidation: isFactorValidationPending,
evaluation: evaluationForApi as
evaluation:
(evaluationForApi as
| ClaimDetailV2ResponseDto["evaluation"]
| undefined,
| undefined) || (enrichedEvaluation as any),
videoCapture,
blameCase: blameCaseForApi,
blameExpertDecision,