forked from Yara724/api
Merge pull request 'Added 'perfomedBy' field to the Timeline' (#272) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#272
This commit is contained in:
@@ -2148,6 +2148,20 @@ export class ExpertInsurerService {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a raw history `actorType` string to either `"user"` or `"expert"`.
|
||||
* - `"user"` → the action was taken by the car-owner / damaged party
|
||||
* - `"expert"` → taken by any expert, system, or back-office actor
|
||||
* - `null` → actorType was absent (unknown)
|
||||
*/
|
||||
private static resolveTimelinePerformedBy(
|
||||
actorType: string | undefined,
|
||||
): "user" | "expert" | null {
|
||||
if (!actorType) return null;
|
||||
if (actorType === "user") return "user";
|
||||
return "expert";
|
||||
}
|
||||
|
||||
async getFileTimeline(
|
||||
insurerId: string,
|
||||
publicId: string,
|
||||
@@ -2187,6 +2201,7 @@ export class ExpertInsurerService {
|
||||
faLabel: getEventFaLabel(ev),
|
||||
timestamp: ev.timestamp,
|
||||
actor: ev.actor ?? null,
|
||||
performedBy: ExpertInsurerService.resolveTimelinePerformedBy(ev.actor?.actorType),
|
||||
metadata: ev.metadata ?? null,
|
||||
});
|
||||
}
|
||||
@@ -2206,6 +2221,7 @@ export class ExpertInsurerService {
|
||||
faLabel: getEventFaLabel(ev),
|
||||
timestamp: ev.timestamp,
|
||||
actor: ev.actor ?? null,
|
||||
performedBy: ExpertInsurerService.resolveTimelinePerformedBy(ev.actor?.actorType),
|
||||
metadata: ev.metadata ?? null,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user