metis-desk/modules/companies/src/api/application/work-profile.repository.ts
David b183627df0 feat: enhance work profile and workstation management
- Added `prepareProfileHosts` function to facilitate the setup of independent workstations for profile scenarios.
- Updated `verifyMail` and `verifyWorkProfiles` functions to utilize the new `prepareProfileHosts` for better host management.
- Refactored `verifyProcesses` to improve workstation update logic and ensure correct status checks.
- Introduced `CurrentWorkstations` component to display workstations under a person's responsibility and usage.
- Implemented `personWorkstations` helper to differentiate between responsible and used workstations for a person.
- Enhanced localization files to include new error messages and descriptions related to workstation management.
- Updated tests to cover new functionality and ensure proper behavior of work profile and workstation interactions.
2026-10-12 01:40:30 +02:00

30 lines
1.1 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 { WorkProfile } from "../domain/work-profile.aggregate";
import type { WorkProfileError } from "../domain/work-profile-values";
export interface IWorkProfileInventoryService {
list(
companyId: UniqueID
): Promise<readonly { id: UniqueID; available: boolean; isProfileHost?: boolean }[]>;
}
export type WorkProfileContext = Readonly<{
profiles: readonly WorkProfile[];
people: readonly { id: UniqueID; active: boolean }[];
assets: readonly { id: UniqueID; available: boolean; isProfileHost?: boolean }[];
items: readonly { id: UniqueID; values: AccessDefinition }[];
actors: ReadonlyMap<string, string>;
today: string;
}>;
export interface IWorkProfileRepository {
get(companyId: UniqueID): Promise<Result<WorkProfileContext, WorkProfileError>>;
save(
companyId: UniqueID,
action: (context: WorkProfileContext) => Result<WorkProfile, WorkProfileError>
): Promise<Result<{ profile: WorkProfile; context: WorkProfileContext }, WorkProfileError>>;
}