2026-10-04 19:04:14 +00:00
|
|
|
import type { WorkstationDTO } from "../../common/workstations";
|
|
|
|
|
import type { Workstation } from "../domain/workstation.aggregate";
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-04 19:04:14 +00:00
|
|
|
export function buildWorkstationResponse(
|
|
|
|
|
item: Workstation,
|
|
|
|
|
names: ReadonlyMap<string, string>
|
|
|
|
|
): WorkstationDTO {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id.toPrimitive(),
|
|
|
|
|
companyId: item.companyId.toPrimitive(),
|
|
|
|
|
values: item.values.toPrimitive(),
|
|
|
|
|
history: item.history.map((revision) => ({
|
|
|
|
|
id: revision.id.toPrimitive(),
|
|
|
|
|
values: revision.values.toPrimitive(),
|
|
|
|
|
actorId: revision.actorId.toPrimitive(),
|
|
|
|
|
actorName: names.get(revision.actorId.toPrimitive()) ?? "",
|
|
|
|
|
recordedAt: revision.recordedAt,
|
|
|
|
|
})),
|
|
|
|
|
};
|
|
|
|
|
}
|