28 lines
1005 B
TypeScript
28 lines
1005 B
TypeScript
import type { UniqueID } from "@repo/rdx-ddd";
|
|
import type { Result } from "@repo/rdx-utils";
|
|
|
|
import type { SupportConnection } from "../domain/support-connection.aggregate";
|
|
|
|
export type SupportResource = Readonly<{ id: UniqueID; name: string; active: boolean }>;
|
|
|
|
import type { SupportError } from "../domain/support-values";
|
|
|
|
export type SupportContext = Readonly<{
|
|
connections: readonly SupportConnection[];
|
|
tools: readonly SupportResource[];
|
|
assetRetired: boolean;
|
|
actorNames: ReadonlyMap<string, string>;
|
|
}>;
|
|
|
|
export interface ISupportRepository {
|
|
remove(company: UniqueID, asset: UniqueID, id: UniqueID): Promise<Result<void, SupportError>>;
|
|
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>
|
|
>;
|
|
}
|