metis-desk/modules/assets/src/api/application/support.repository.ts

27 lines
1.0 KiB
TypeScript
Raw Normal View History

2026-10-07 08:16:39 +00:00
import type { UniqueID } from "@repo/rdx-ddd";
import type { Result } from "@repo/rdx-utils";
import type { SupportConnection } from "../domain/support-connection.aggregate";
import type { SupportTool } from "../domain/support-tool.aggregate";
import type { SupportError } from "../domain/support-values";
export type SupportContext = Readonly<{
connections: readonly SupportConnection[];
tools: readonly SupportTool[];
assetRetired: boolean;
actorNames: ReadonlyMap<string, string>;
}>;
export interface ISupportRepository {
get(company: UniqueID, asset: UniqueID): Promise<Result<SupportContext, SupportError>>;
save(
company: UniqueID,
asset: UniqueID,
action: (context: SupportContext) => Result<SupportConnection, SupportError>
): Promise<
Result<{ connection: SupportConnection; actorNames: ReadonlyMap<string, string> }, SupportError>
>;
tools(): Promise<readonly SupportTool[]>;
saveTool(
action: (tools: readonly SupportTool[]) => Result<SupportTool, SupportError>
): Promise<Result<SupportTool, SupportError>>;
}