forked from Yara724/api
YARA-977
This commit is contained in:
42
src/expert-insurer/helper/insurer.helper.ts
Normal file
42
src/expert-insurer/helper/insurer.helper.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
export function extractExpertNamesFromBlame(b: any): string[] {
|
||||
const names = new Set<string>();
|
||||
|
||||
const add = (v: unknown) => {
|
||||
if (typeof v === "string" && v.trim()) names.add(v.trim());
|
||||
};
|
||||
|
||||
add(b?.workflow?.assignedForReviewBy?.actorName);
|
||||
add(b?.workflow?.lockedBy?.actorName);
|
||||
|
||||
// History entries from expert actions
|
||||
for (const h of b?.history ?? []) {
|
||||
if (
|
||||
h?.actor?.actorType === "field_expert" ||
|
||||
h?.actor?.actorType === "damage_expert"
|
||||
) {
|
||||
add(h?.actor?.actorName);
|
||||
}
|
||||
}
|
||||
|
||||
return [...names];
|
||||
}
|
||||
|
||||
export function extractExpertNamesFromClaim(c: any): string[] {
|
||||
const names = new Set<string>();
|
||||
|
||||
const add = (v: unknown) => {
|
||||
if (typeof v === "string" && v.trim()) names.add(v.trim());
|
||||
};
|
||||
|
||||
add(c?.workflow?.assignedForReviewBy?.actorName);
|
||||
add(c?.workflow?.lockedBy?.actorName);
|
||||
|
||||
// Evaluation snapshots
|
||||
add(c?.evaluation?.damageExpertResend?.expertProfileSnapshot?.fullName);
|
||||
add(c?.evaluation?.damageExpertReply?.expertProfileSnapshot?.fullName);
|
||||
add(c?.evaluation?.damageExpertReplyFinal?.expertProfileSnapshot?.fullName);
|
||||
add(c?.evaluation?.factorValidationExpertProfileSnapshot?.fullName);
|
||||
add(c?.evaluation?.inPersonVisitExpertProfileSnapshot?.fullName);
|
||||
|
||||
return [...names];
|
||||
}
|
||||
Reference in New Issue
Block a user