forked from Yara724/api
Add case identity filters and description validation
This commit is contained in:
@@ -778,6 +778,7 @@ export class ExpertClaimService {
|
||||
creationMethod?: string;
|
||||
carBodyFirstForm?: { car?: boolean; object?: boolean };
|
||||
blameStatus?: string;
|
||||
partyIdentities?: Array<Record<string, unknown>>;
|
||||
} {
|
||||
if (!blame?.type) return {};
|
||||
const blameRequestType = blame.type as BlameRequestType;
|
||||
@@ -786,12 +787,26 @@ export class ExpertClaimService {
|
||||
creationMethod?: string;
|
||||
carBodyFirstForm?: { car?: boolean; object?: boolean };
|
||||
blameStatus?: string;
|
||||
partyIdentities?: Array<Record<string, unknown>>;
|
||||
} = { blameRequestType };
|
||||
if (blame.creationMethod) out.creationMethod = blame.creationMethod;
|
||||
out.blameStatus = blame.blameStatus;
|
||||
if (blameRequestType !== BlameRequestType.CAR_BODY) return out;
|
||||
|
||||
const parties = blame.parties;
|
||||
if (Array.isArray(parties) && parties.length > 0) {
|
||||
out.partyIdentities = parties.map((party: any) => ({
|
||||
phoneNumber: party?.person?.phoneNumber,
|
||||
nationalCode: party?.person?.nationalCode,
|
||||
nationalCodeOfInsurer: party?.person?.nationalCodeOfInsurer,
|
||||
nationalCodeOfDriver: party?.person?.nationalCodeOfDriver,
|
||||
inquiryParticipants: Array.isArray(party?.inquiryParticipants)
|
||||
? party.inquiryParticipants.map((participant: any) => ({
|
||||
phoneNumber: participant?.phoneNumber,
|
||||
nationalCode: participant?.nationalCode,
|
||||
}))
|
||||
: undefined,
|
||||
}));
|
||||
}
|
||||
if (blameRequestType !== BlameRequestType.CAR_BODY) return out;
|
||||
if (!Array.isArray(parties) || parties.length === 0) return out;
|
||||
|
||||
const first =
|
||||
@@ -4393,6 +4408,8 @@ export class ExpertClaimService {
|
||||
? { carName: v.carName, carModel: v.carModel, carType: v.carType }
|
||||
: undefined,
|
||||
...fileCtx,
|
||||
partyIdentities:
|
||||
fileCtx.partyIdentities ?? c.parties ?? c.snapshot?.parties,
|
||||
blameRequestId: c.blameRequestId?.toString(),
|
||||
createdAt: c.createdAt,
|
||||
awaitingFactorValidation,
|
||||
@@ -4486,6 +4503,8 @@ export class ExpertClaimService {
|
||||
? { carName: v.carName, carModel: v.carModel, carType: v.carType }
|
||||
: undefined,
|
||||
...fileCtx,
|
||||
partyIdentities:
|
||||
fileCtx.partyIdentities ?? c.parties ?? c.snapshot?.parties,
|
||||
blameRequestId: c.blameRequestId?.toString(),
|
||||
createdAt: c.createdAt,
|
||||
awaitingFactorValidation: claimIsAwaitingExpertFactorValidationV2(c),
|
||||
@@ -4625,6 +4644,8 @@ export class ExpertClaimService {
|
||||
? { carName: v.carName, carModel: v.carModel, carType: v.carType }
|
||||
: undefined,
|
||||
...fileCtx,
|
||||
partyIdentities:
|
||||
fileCtx.partyIdentities ?? c.parties ?? c.snapshot?.parties,
|
||||
blameRequestId: c.blameRequestId?.toString(),
|
||||
createdAt: c.createdAt,
|
||||
awaitingFactorValidation: claimIsAwaitingExpertFactorValidationV2(c),
|
||||
@@ -4720,6 +4741,8 @@ export class ExpertClaimService {
|
||||
? { carName: v.carName, carModel: v.carModel, carType: v.carType }
|
||||
: undefined,
|
||||
...fileCtx,
|
||||
partyIdentities:
|
||||
fileCtx.partyIdentities ?? c.parties ?? c.snapshot?.parties,
|
||||
blameRequestId: c.blameRequestId?.toString(),
|
||||
createdAt: c.createdAt,
|
||||
awaitingFactorValidation: claimIsAwaitingExpertFactorValidationV2(c),
|
||||
|
||||
Reference in New Issue
Block a user