27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
|
|
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>>;
|
||
|
|
}
|