2026-10-07 08:16:39 +00:00
|
|
|
import type { SupportConnectionDTO, SupportToolDTO } from "../../common/support";
|
|
|
|
|
import type { SupportConnection } from "../domain/support-connection.aggregate";
|
|
|
|
|
import type { SupportTool } from "../domain/support-tool.aggregate";
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-07 08:16:39 +00:00
|
|
|
export function buildSupportTool(tool: SupportTool): SupportToolDTO {
|
|
|
|
|
return {
|
|
|
|
|
id: tool.id.toPrimitive(),
|
|
|
|
|
name: tool.name.toPrimitive(),
|
|
|
|
|
active: tool.active,
|
|
|
|
|
builtin: tool.builtin,
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-07 08:16:39 +00:00
|
|
|
export function buildSupport(
|
|
|
|
|
connection: SupportConnection,
|
|
|
|
|
names: ReadonlyMap<string, string>
|
|
|
|
|
): SupportConnectionDTO {
|
|
|
|
|
return {
|
|
|
|
|
id: connection.id.toPrimitive(),
|
|
|
|
|
companyId: connection.companyId.toPrimitive(),
|
|
|
|
|
assetId: connection.assetId.toPrimitive(),
|
|
|
|
|
values: connection.values.toPrimitive(),
|
|
|
|
|
history: connection.history.map((revision) => ({
|
|
|
|
|
id: revision.id.toPrimitive(),
|
|
|
|
|
values: revision.values.toPrimitive(),
|
|
|
|
|
actorId: revision.actorId.toPrimitive(),
|
|
|
|
|
actorName: names.get(revision.actorId.toPrimitive()) ?? revision.actorId.toPrimitive(),
|
|
|
|
|
recordedAt: revision.recordedAt,
|
|
|
|
|
})),
|
|
|
|
|
};
|
|
|
|
|
}
|