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 11, 2024
1 parent 75b659f commit 8746261
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 @@ -45,7 +45,6 @@ import { RoleRepository } from "./domain/repositories/RoleRepository";
import { RoleD2Repository } from "./data/repositories/RoleD2Repository";
import { RoleTestRepository } from "./data/repositories/test/RoleTestRepository";
import { DeleteIncidentManagementTeamMemberRoleUseCase } from "./domain/usecases/DeleteIncidentManagementTeamMemberRoleUseCase";
import { GetIncidentManagementTeamByIdUseCase } from "./domain/usecases/GetIncidentManagementTeamByIdUseCase";

export type CompositionRoot = ReturnType<typeof getCompositionRoot>;

Expand Down Expand Up @@ -78,9 +77,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 8746261

Please sign in to comment.