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