metis-desk/modules/resources/src/api/application/resource.repository.ts
David 72c2a5101d feat: implement resource lifecycle management with delete functionality
- Added `verifyResourceLifecycle` integration to handle resource lifecycle operations.
- Introduced `remove` method in `IResourceRepository` and implemented it in `SequelizeResourceRepository`.
- Created `DeleteResourceDialog` component for confirming resource deletion.
- Updated `resource.use-cases` to include `remove` and `setActive` methods for managing resource states.
- Enhanced API routes to support resource status updates and deletions.
- Added tests for resource lifecycle operations, ensuring correct behavior for activation, deactivation, and deletion.
- Updated UI components to integrate new deletion functionality and provide feedback on resource status changes.
- Improved localization for resource lifecycle actions in both English and Spanish.
2026-10-17 13:58:29 +02:00

26 lines
1.0 KiB
TypeScript

import type { UniqueID } from "@repo/rdx-ddd";
import type { Result } from "@repo/rdx-utils";
import type { ResourceReferenceDTO } from "../../common/inventory";
import type { Resource } from "../domain/resource.aggregate";
import type { ResourceCatalog } from "../domain/resource-catalog.aggregate";
import type { ResourceCatalogError } from "../domain/resource-definition";
export type InventoryContext = Readonly<{
catalog: ResourceCatalog;
resources: readonly Resource[];
actorNames: ReadonlyMap<string, string>;
references: readonly ResourceReferenceDTO[];
}>;
export interface IResourceRepository {
remove(companyId: UniqueID, id: UniqueID): Promise<Result<void, ResourceCatalogError>>;
get(companyId: UniqueID): Promise<Result<InventoryContext, ResourceCatalogError>>;
save(
companyId: UniqueID,
action: (context: InventoryContext) => Result<Resource, ResourceCatalogError>
): Promise<
Result<{ resource: Resource; actorNames: ReadonlyMap<string, string> }, ResourceCatalogError>
>;
}