forked from Yara724/api
Fix get details for insurer
This commit is contained in:
@@ -147,6 +147,25 @@ export class ExpertInsurerService {
|
||||
}));
|
||||
}
|
||||
|
||||
private sanitizeVehicleInquiry(vehicle: any) {
|
||||
if (!vehicle || typeof vehicle !== "object") return vehicle;
|
||||
const inquiry = vehicle.inquiry;
|
||||
if (!inquiry || typeof inquiry !== "object") return vehicle;
|
||||
const { raw, mapped, ...safeInquiry } = inquiry;
|
||||
return {
|
||||
...vehicle,
|
||||
inquiry: safeInquiry,
|
||||
};
|
||||
}
|
||||
|
||||
private sanitizePartyForInsurerView(party: any) {
|
||||
if (!party || typeof party !== "object") return party;
|
||||
return {
|
||||
...party,
|
||||
vehicle: this.sanitizeVehicleInquiry(party.vehicle),
|
||||
};
|
||||
}
|
||||
|
||||
private getCombinedFileScore(file: any): number | null {
|
||||
const insurerRating = file?.rating;
|
||||
const userRating = file?.userRating;
|
||||
@@ -543,6 +562,9 @@ export class ExpertInsurerService {
|
||||
const parties = Array.isArray((blame as any)?.parties) ? (blame as any).parties : [];
|
||||
const firstParty = parties.find((p: any) => p?.role === "FIRST");
|
||||
const secondParty = parties.find((p: any) => p?.role === "SECOND");
|
||||
const claimSnapshotParties = Array.isArray((claim as any)?.snapshot?.parties)
|
||||
? (claim as any).snapshot.parties
|
||||
: undefined;
|
||||
|
||||
const overview = {
|
||||
publicId,
|
||||
@@ -575,7 +597,7 @@ export class ExpertInsurerService {
|
||||
fullName: firstParty?.person?.fullName,
|
||||
phoneNumber: firstParty?.person?.phoneNumber,
|
||||
role: firstParty?.role,
|
||||
vehicle: firstParty?.vehicle,
|
||||
vehicle: this.sanitizeVehicleInquiry(firstParty?.vehicle),
|
||||
}
|
||||
: undefined,
|
||||
second: secondParty
|
||||
@@ -583,7 +605,7 @@ export class ExpertInsurerService {
|
||||
fullName: secondParty?.person?.fullName,
|
||||
phoneNumber: secondParty?.person?.phoneNumber,
|
||||
role: secondParty?.role,
|
||||
vehicle: secondParty?.vehicle,
|
||||
vehicle: this.sanitizeVehicleInquiry(secondParty?.vehicle),
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
@@ -609,6 +631,20 @@ export class ExpertInsurerService {
|
||||
(claim as any).requestNo || String((claim as any).requestNumber || ""),
|
||||
status: (claim as any).status,
|
||||
claimStatus: (claim as any).claimStatus,
|
||||
owner: (claim as any).owner,
|
||||
vehicle: (claim as any).vehicle,
|
||||
money: (claim as any).money,
|
||||
damage: (claim as any).damage,
|
||||
media: (claim as any).media,
|
||||
requiredDocuments: (claim as any).requiredDocuments,
|
||||
snapshot: (claim as any).snapshot
|
||||
? {
|
||||
...(claim as any).snapshot,
|
||||
parties: claimSnapshotParties?.map((p: any) =>
|
||||
this.sanitizePartyForInsurerView(p),
|
||||
),
|
||||
}
|
||||
: undefined,
|
||||
workflow: {
|
||||
currentStep: (claim as any).currentStep,
|
||||
nextStep: (claim as any).nextStep,
|
||||
@@ -620,6 +656,7 @@ export class ExpertInsurerService {
|
||||
objection: (claim as any).objection,
|
||||
priceDrop: (claim as any).priceDrop,
|
||||
visitLocation: (claim as any).visitLocation,
|
||||
factors: (claim as any).evaluation?.factors,
|
||||
},
|
||||
userResendDocuments: (claim as any).userResendDocuments,
|
||||
userRating: (claim as any).userRating,
|
||||
|
||||
Reference in New Issue
Block a user