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 {
|
private getCombinedFileScore(file: any): number | null {
|
||||||
const insurerRating = file?.rating;
|
const insurerRating = file?.rating;
|
||||||
const userRating = file?.userRating;
|
const userRating = file?.userRating;
|
||||||
@@ -543,6 +562,9 @@ export class ExpertInsurerService {
|
|||||||
const parties = Array.isArray((blame as any)?.parties) ? (blame as any).parties : [];
|
const parties = Array.isArray((blame as any)?.parties) ? (blame as any).parties : [];
|
||||||
const firstParty = parties.find((p: any) => p?.role === "FIRST");
|
const firstParty = parties.find((p: any) => p?.role === "FIRST");
|
||||||
const secondParty = parties.find((p: any) => p?.role === "SECOND");
|
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 = {
|
const overview = {
|
||||||
publicId,
|
publicId,
|
||||||
@@ -575,7 +597,7 @@ export class ExpertInsurerService {
|
|||||||
fullName: firstParty?.person?.fullName,
|
fullName: firstParty?.person?.fullName,
|
||||||
phoneNumber: firstParty?.person?.phoneNumber,
|
phoneNumber: firstParty?.person?.phoneNumber,
|
||||||
role: firstParty?.role,
|
role: firstParty?.role,
|
||||||
vehicle: firstParty?.vehicle,
|
vehicle: this.sanitizeVehicleInquiry(firstParty?.vehicle),
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
second: secondParty
|
second: secondParty
|
||||||
@@ -583,7 +605,7 @@ export class ExpertInsurerService {
|
|||||||
fullName: secondParty?.person?.fullName,
|
fullName: secondParty?.person?.fullName,
|
||||||
phoneNumber: secondParty?.person?.phoneNumber,
|
phoneNumber: secondParty?.person?.phoneNumber,
|
||||||
role: secondParty?.role,
|
role: secondParty?.role,
|
||||||
vehicle: secondParty?.vehicle,
|
vehicle: this.sanitizeVehicleInquiry(secondParty?.vehicle),
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
@@ -609,6 +631,20 @@ export class ExpertInsurerService {
|
|||||||
(claim as any).requestNo || String((claim as any).requestNumber || ""),
|
(claim as any).requestNo || String((claim as any).requestNumber || ""),
|
||||||
status: (claim as any).status,
|
status: (claim as any).status,
|
||||||
claimStatus: (claim as any).claimStatus,
|
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: {
|
workflow: {
|
||||||
currentStep: (claim as any).currentStep,
|
currentStep: (claim as any).currentStep,
|
||||||
nextStep: (claim as any).nextStep,
|
nextStep: (claim as any).nextStep,
|
||||||
@@ -620,6 +656,7 @@ export class ExpertInsurerService {
|
|||||||
objection: (claim as any).objection,
|
objection: (claim as any).objection,
|
||||||
priceDrop: (claim as any).priceDrop,
|
priceDrop: (claim as any).priceDrop,
|
||||||
visitLocation: (claim as any).visitLocation,
|
visitLocation: (claim as any).visitLocation,
|
||||||
|
factors: (claim as any).evaluation?.factors,
|
||||||
},
|
},
|
||||||
userResendDocuments: (claim as any).userResendDocuments,
|
userResendDocuments: (claim as any).userResendDocuments,
|
||||||
userRating: (claim as any).userRating,
|
userRating: (claim as any).userRating,
|
||||||
|
|||||||
Reference in New Issue
Block a user