Skip to content

Commit

Permalink
Delete from CompositionRoot functions related to incidentManagementTe…
Browse files Browse the repository at this point in the history
…am and move it to diseaseOutbreakEvent
  • Loading branch information
anagperal committed Oct 18, 2024
1 parent 5f30ec9 commit 3ece306
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/CompositionRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof getCompositionRoot>;

Expand Down Expand Up @@ -90,9 +89,6 @@ function getCompositionRoot(repositories: Repositories) {
repositories.alertSyncRepository,
repositories.optionsRepository
),
},
incidentManagementTeam: {
get: new GetIncidentManagementTeamByIdUseCase(repositories),
deleteIncidentManagementTeamMemberRole:
new DeleteIncidentManagementTeamMemberRoleUseCase(repositories),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export function useIMTeamBuilder(id: Id): State {
const [searchTerm, setSearchTerm] = useState<string>("");

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(
Expand All @@ -74,7 +75,7 @@ export function useIMTeamBuilder(id: Id): State {
});
}
);
}, [compositionRoot.incidentManagementTeam.get, id]);
}, [compositionRoot.diseaseOutbreakEvent.get, id]);

useEffect(() => {
getIncidentManagementTeam();
Expand Down Expand Up @@ -151,7 +152,7 @@ export function useIMTeamBuilder(id: Id): State {
);

if (teamMember && teamRoleToDelete) {
compositionRoot.incidentManagementTeam.deleteIncidentManagementTeamMemberRole
compositionRoot.diseaseOutbreakEvent.deleteIncidentManagementTeamMemberRole
.execute(teamRoleToDelete, teamMember, id)
.run(
() => {
Expand All @@ -178,7 +179,7 @@ export function useIMTeamBuilder(id: Id): State {
});
}
}, [
compositionRoot.incidentManagementTeam.deleteIncidentManagementTeamMemberRole,
compositionRoot.diseaseOutbreakEvent.deleteIncidentManagementTeamMemberRole,
disableDeletion,
getIncidentManagementTeam,
id,
Expand Down

0 comments on commit 3ece306

Please sign in to comment.