2026-10-06 15:15:42 +00:00
|
|
|
import type { UniqueID } from "@repo/rdx-ddd";
|
|
|
|
|
import type { Result } from "@repo/rdx-utils";
|
|
|
|
|
|
|
|
|
|
import type { ApplicationConfiguration } from "../domain/application-configuration.aggregate";
|
|
|
|
|
import type { ApplicationConfigurationError } from "../domain/application-configuration-values";
|
|
|
|
|
import type { WorkProfile } from "../domain/work-profile.aggregate";
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-06 15:15:42 +00:00
|
|
|
export type ApplicationContext = Readonly<{
|
|
|
|
|
configurations: readonly ApplicationConfiguration[];
|
|
|
|
|
profiles: readonly WorkProfile[];
|
|
|
|
|
people: readonly { id: UniqueID; active: boolean }[];
|
|
|
|
|
assets: readonly { id: UniqueID; available: boolean }[];
|
|
|
|
|
resources: readonly {
|
|
|
|
|
id: UniqueID;
|
|
|
|
|
active: boolean;
|
2026-10-10 16:21:06 +00:00
|
|
|
usage: "application" | "certificate" | "support" | null;
|
2026-10-06 15:15:42 +00:00
|
|
|
}[];
|
|
|
|
|
actors: ReadonlyMap<string, string>;
|
|
|
|
|
}>;
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-06 15:15:42 +00:00
|
|
|
export interface IApplicationConfigurationRepository {
|
2026-10-09 22:19:35 +00:00
|
|
|
remove(company: UniqueID, id: UniqueID): Promise<Result<void, ApplicationConfigurationError>>;
|
2026-10-06 15:15:42 +00:00
|
|
|
get(company: UniqueID): Promise<Result<ApplicationContext, ApplicationConfigurationError>>;
|
|
|
|
|
save(
|
|
|
|
|
company: UniqueID,
|
|
|
|
|
action: (
|
|
|
|
|
context: ApplicationContext
|
|
|
|
|
) => Result<ApplicationConfiguration, ApplicationConfigurationError>
|
|
|
|
|
): Promise<
|
|
|
|
|
Result<
|
|
|
|
|
{ configuration: ApplicationConfiguration; context: ApplicationContext },
|
|
|
|
|
ApplicationConfigurationError
|
|
|
|
|
>
|
|
|
|
|
>;
|
|
|
|
|
}
|