From 3ece30668d38042e5c58edef84d38112c7099fe9 Mon Sep 17 00:00:00 2001 From: Ana Garcia Date: Fri, 11 Oct 2024 08:04:42 +0200 Subject: [PATCH] Delete from CompositionRoot functions related to incidentManagementTeam and move it to diseaseOutbreakEvent --- src/CompositionRoot.ts | 4 ---- .../useIMTeamBuilder.ts | 11 ++++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/CompositionRoot.ts b/src/CompositionRoot.ts index 9f698330..861454b2 100644 --- a/src/CompositionRoot.ts +++ b/src/CompositionRoot.ts @@ -55,7 +55,6 @@ import { SystemRepository } from "./domain/repositories/SystemRepository"; import { SystemD2Repository } from "./data/repositories/SystemD2Repository"; import { SystemTestRepository } from "./data/repositories/test/SystemTestRepository"; import { GetOverviewCardsUseCase } from "./domain/usecases/GetOverviewCardsUseCase"; -import { GetIncidentManagementTeamByIdUseCase } from "./domain/usecases/GetIncidentManagementTeamByIdUseCase"; export type CompositionRoot = ReturnType; @@ -90,9 +89,6 @@ function getCompositionRoot(repositories: Repositories) { repositories.alertSyncRepository, repositories.optionsRepository ), - }, - incidentManagementTeam: { - get: new GetIncidentManagementTeamByIdUseCase(repositories), deleteIncidentManagementTeamMemberRole: new DeleteIncidentManagementTeamMemberRoleUseCase(repositories), }, diff --git a/src/webapp/pages/incident-management-team-builder/useIMTeamBuilder.ts b/src/webapp/pages/incident-management-team-builder/useIMTeamBuilder.ts index 16b84d1f..898cddac 100644 --- a/src/webapp/pages/incident-management-team-builder/useIMTeamBuilder.ts +++ b/src/webapp/pages/incident-management-team-builder/useIMTeamBuilder.ts @@ -57,8 +57,9 @@ export function useIMTeamBuilder(id: Id): State { const [searchTerm, setSearchTerm] = useState(""); const getIncidentManagementTeam = useCallback(() => { - compositionRoot.incidentManagementTeam.get.execute(id).run( - incidentManagementTeam => { + compositionRoot.diseaseOutbreakEvent.get.execute(id).run( + diseaseOutbreakEvent => { + const incidentManagementTeam = diseaseOutbreakEvent?.incidentManagementTeam; setIncidentManagementTeam(incidentManagementTeam); setIncidentManagementTeamHierarchyItems( mapIncidentManagementTeamToIncidentManagementTeamHierarchyItems( @@ -74,7 +75,7 @@ export function useIMTeamBuilder(id: Id): State { }); } ); - }, [compositionRoot.incidentManagementTeam.get, id]); + }, [compositionRoot.diseaseOutbreakEvent.get, id]); useEffect(() => { getIncidentManagementTeam(); @@ -151,7 +152,7 @@ export function useIMTeamBuilder(id: Id): State { ); if (teamMember && teamRoleToDelete) { - compositionRoot.incidentManagementTeam.deleteIncidentManagementTeamMemberRole + compositionRoot.diseaseOutbreakEvent.deleteIncidentManagementTeamMemberRole .execute(teamRoleToDelete, teamMember, id) .run( () => { @@ -178,7 +179,7 @@ export function useIMTeamBuilder(id: Id): State { }); } }, [ - compositionRoot.incidentManagementTeam.deleteIncidentManagementTeamMemberRole, + compositionRoot.diseaseOutbreakEvent.deleteIncidentManagementTeamMemberRole, disableDeletion, getIncidentManagementTeam, id,