27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
|
|
import type { UniqueID } from "@repo/rdx-ddd";
|
||
|
|
import type { Result } from "@repo/rdx-utils";
|
||
|
|
|
||
|
|
import type { AccessDefinition } from "../domain/access/access-definition";
|
||
|
|
import type { MailConfiguration } from "../domain/mail-configuration.aggregate";
|
||
|
|
import type { MailConfigurationError } from "../domain/mail-configuration-values";
|
||
|
|
export interface IMailInventoryService {
|
||
|
|
list(companyId: UniqueID): Promise<readonly Readonly<{ id: UniqueID; available: boolean }>[]>;
|
||
|
|
}
|
||
|
|
export type MailContext = Readonly<{
|
||
|
|
configurations: readonly MailConfiguration[];
|
||
|
|
people: readonly Readonly<{ id: UniqueID; active: boolean }>[];
|
||
|
|
items: readonly Readonly<{ id: UniqueID; values: AccessDefinition }>[];
|
||
|
|
assets: readonly Readonly<{ id: UniqueID; available: boolean }>[];
|
||
|
|
actors: ReadonlyMap<string, string>;
|
||
|
|
today: string;
|
||
|
|
}>;
|
||
|
|
export interface IMailConfigurationRepository {
|
||
|
|
get(companyId: UniqueID): Promise<Result<MailContext, MailConfigurationError>>;
|
||
|
|
save(
|
||
|
|
companyId: UniqueID,
|
||
|
|
action: (context: MailContext) => Result<MailConfiguration, MailConfigurationError>
|
||
|
|
): Promise<
|
||
|
|
Result<{ configuration: MailConfiguration; context: MailContext }, MailConfigurationError>
|
||
|
|
>;
|
||
|
|
}
|