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
anagperal committed Oct 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5f30ec9 commit 3ece306
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
@@ -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>;

@@ -90,9 +89,6 @@ function getCompositionRoot(repositories: Repositories) {
repositories.alertSyncRepository,
repositories.optionsRepository
),
},
incidentManagementTeam: {
get: new GetIncidentManagementTeamByIdUseCase(repositories),
deleteIncidentManagementTeamMemberRole:
new DeleteIncidentManagementTeamMemberRoleUseCase(repositories),
},
Original file line number Diff line number Diff line change
@@ -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(
@@ -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,

0 comments on commit 3ece306

Please sign in to comment.