1
0
forked from Yara724/api
This commit is contained in:
SepehrYahyaee
2026-04-25 17:10:07 +03:30
parent 5d2227b00b
commit 05c5b70b4d
3 changed files with 41 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ export class AiService implements OnModuleInit {
username: process.env.AI_USERNAME, username: process.env.AI_USERNAME,
password: process.env.AI_PASSWORD, password: process.env.AI_PASSWORD,
}, },
timeout: 1000, // 30 second timeout timeout: 30000, // 30 second timeout
}; };
private get profileOptions(): AxiosRequestConfig { private get profileOptions(): AxiosRequestConfig {

View File

@@ -5009,8 +5009,30 @@ export class ClaimRequestManagementService {
}; };
} }
const getPartLabelFa = (key: string): string => {
const labels: Record<string, string> = {
hood: 'کاپوت',
trunk: 'صندوق عقب',
roof: 'سقف',
front_right_door: 'درب جلو راست',
front_left_door: 'درب جلو چپ',
rear_right_door: 'درب عقب راست',
rear_left_door: 'درب عقب چپ',
front_bumper: 'سپر جلو',
rear_bumper: 'سپر عقب',
front_right_fender: 'گلگیر جلو راست',
front_left_fender: 'گلگیر جلو چپ',
rear_right_fender: 'گلگیر عقب راست',
rear_left_fender: 'گلگیر عقب چپ',
};
return labels[key] || key;
};
const damagedPartsData = claim.media?.damagedParts as any; const damagedPartsData = claim.media?.damagedParts as any;
const damagedParts: Record<string, { captured: boolean; url?: string }> = {}; const damagedParts: Record<
string,
{ label_fa: string; captured: boolean; url?: string }
> = {};
const resendPartKeys = normalizeResendPartKeys( const resendPartKeys = normalizeResendPartKeys(
claim.evaluation?.damageExpertResend?.resendCarParts, claim.evaluation?.damageExpertResend?.resendCarParts,
); );
@@ -5021,6 +5043,7 @@ export class ClaimRequestManagementService {
for (const p of partKeysForDetails) { for (const p of partKeysForDetails) {
const cap = hasCapture(damagedPartsData, p); const cap = hasCapture(damagedPartsData, p);
damagedParts[p] = { damagedParts[p] = {
label_fa: getPartLabelFa(p),
captured: !!cap, captured: !!cap,
url: cap?.url || (cap?.path ? buildFileLink(cap.path) : undefined), url: cap?.url || (cap?.path ? buildFileLink(cap.path) : undefined),
}; };
@@ -5080,6 +5103,12 @@ export class ClaimRequestManagementService {
carAngles, carAngles,
damagedParts, damagedParts,
expertResend, expertResend,
evaluation: claim.evaluation
? {
damageExpertReply: claim.evaluation.damageExpertReply,
damageExpertReplyFinal: claim.evaluation.damageExpertReplyFinal,
}
: undefined,
...(isExpertViewer ...(isExpertViewer
? { ? {
userRating: claim.userRating userRating: claim.userRating

View File

@@ -76,7 +76,7 @@ export class ClaimDetailsV2ResponseDto {
carAngles?: Record<string, { captured: boolean; url?: string }>; carAngles?: Record<string, { captured: boolean; url?: string }>;
@ApiPropertyOptional({ description: 'Damaged parts captured' }) @ApiPropertyOptional({ description: 'Damaged parts captured' })
damagedParts?: Record<string, { captured: boolean; url?: string }>; damagedParts?: Record<string, { label_fa: string; captured: boolean; url?: string }>;
@ApiPropertyOptional({ @ApiPropertyOptional({
description: description:
@@ -84,6 +84,15 @@ export class ClaimDetailsV2ResponseDto {
}) })
expertResend?: ExpertResendDetailsV2Dto; expertResend?: ExpertResendDetailsV2Dto;
@ApiPropertyOptional({
description: "Damage expert opinion(s): initial and final (after objection).",
type: Object,
})
evaluation?: {
damageExpertReply?: unknown;
damageExpertReplyFinal?: unknown;
};
@ApiPropertyOptional({ description: 'User satisfaction rating (if submitted)' }) @ApiPropertyOptional({ description: 'User satisfaction rating (if submitted)' })
userRating?: { userRating?: {
progressSpeed: number; progressSpeed: number;