mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* --init * -- * replace old structure with new DI * fix type * -- * moving stuff around * moving stuff around again * minor clean up * -- * resolve conflict * clea up * old schema clean up * further clean up * removing unwanted merged responsibilities * -- * improve DI and SOLID * some type fixes * --1 * clean up --cont * fix DI in facade for test * more fix * fix * checking * o.o * fix import * fix failing test --2 * fix failing test --3 * fix failing test --4 * normalization use * introduce facade container injection * uniform async telemetry spans * further improvements * replace prismock with repo mocks * ensure we don't pass prisma outside of repo * fix import * remove try catch from repo calls * async await fixes * using deps pattern * more clean up and fixes * more clean up * address feedback --1 * separation of concern * clean up * test clean up * feedback --2 * remove extra fetch * remove await * migrate _post test from prismock * fix type * -- * fix tokens path * rename AuditRepo * test --1 * update _post to integration test * fix test * fix test * test fix maybe? * -- * feedback * feedback * fixes * more feedback * NIT * use sentry and logger imports as planned * assertion in test * add missing test case * add tests for controllers and services * NITs * fix domain normalisation
67 lines
3.1 KiB
TypeScript
67 lines
3.1 KiB
TypeScript
import { createContainer } from "@evyweb/ioctopus";
|
|
|
|
import { loggerServiceModule } from "@calcom/features/di/shared/services/logger.service";
|
|
import { taskerServiceModule } from "@calcom/features/di/shared/services/tasker.service";
|
|
import { SHARED_TOKENS } from "@calcom/features/di/shared/shared.tokens";
|
|
import {
|
|
createWatchlistFeature,
|
|
type WatchlistFeature,
|
|
} from "@calcom/features/watchlist/lib/facade/WatchlistFeature";
|
|
import type { IGlobalWatchlistRepository } from "@calcom/features/watchlist/lib/interface/IWatchlistRepositories";
|
|
import type { IOrganizationWatchlistRepository } from "@calcom/features/watchlist/lib/interface/IWatchlistRepositories";
|
|
import type { GlobalBlockingService } from "@calcom/features/watchlist/lib/service/GlobalBlockingService";
|
|
import type { OrganizationBlockingService } from "@calcom/features/watchlist/lib/service/OrganizationBlockingService";
|
|
import type { WatchlistAuditService } from "@calcom/features/watchlist/lib/service/WatchlistAuditService";
|
|
import type { WatchlistService } from "@calcom/features/watchlist/lib/service/WatchlistService";
|
|
import { moduleLoader as prismaModuleLoader } from "@calcom/prisma/prisma.module";
|
|
|
|
import { WATCHLIST_DI_TOKENS } from "../Watchlist.tokens";
|
|
import { watchlistModule } from "../modules/Watchlist.module";
|
|
|
|
export const watchlistContainer = createContainer();
|
|
|
|
prismaModuleLoader.loadModule(watchlistContainer);
|
|
|
|
watchlistContainer.load(SHARED_TOKENS.LOGGER, loggerServiceModule);
|
|
watchlistContainer.load(SHARED_TOKENS.TASKER, taskerServiceModule);
|
|
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.GLOBAL_WATCHLIST_REPOSITORY, watchlistModule);
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.ORGANIZATION_WATCHLIST_REPOSITORY, watchlistModule);
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.AUDIT_REPOSITORY, watchlistModule);
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.WATCHLIST_SERVICE, watchlistModule);
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.AUDIT_SERVICE, watchlistModule);
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.GLOBAL_BLOCKING_SERVICE, watchlistModule);
|
|
watchlistContainer.load(WATCHLIST_DI_TOKENS.ORGANIZATION_BLOCKING_SERVICE, watchlistModule);
|
|
|
|
export function getWatchlistService() {
|
|
return watchlistContainer.get<WatchlistService>(WATCHLIST_DI_TOKENS.WATCHLIST_SERVICE);
|
|
}
|
|
|
|
export function getGlobalBlockingService() {
|
|
return watchlistContainer.get<GlobalBlockingService>(WATCHLIST_DI_TOKENS.GLOBAL_BLOCKING_SERVICE);
|
|
}
|
|
|
|
export function getOrganizationBlockingService() {
|
|
return watchlistContainer.get<OrganizationBlockingService>(
|
|
WATCHLIST_DI_TOKENS.ORGANIZATION_BLOCKING_SERVICE
|
|
);
|
|
}
|
|
|
|
export function getAuditService() {
|
|
return watchlistContainer.get<WatchlistAuditService>(WATCHLIST_DI_TOKENS.AUDIT_SERVICE);
|
|
}
|
|
|
|
export function getGlobalWatchlistRepository() {
|
|
return watchlistContainer.get<IGlobalWatchlistRepository>(WATCHLIST_DI_TOKENS.GLOBAL_WATCHLIST_REPOSITORY);
|
|
}
|
|
|
|
export function getOrganizationWatchlistRepository() {
|
|
return watchlistContainer.get<IOrganizationWatchlistRepository>(
|
|
WATCHLIST_DI_TOKENS.ORGANIZATION_WATCHLIST_REPOSITORY
|
|
);
|
|
}
|
|
|
|
export async function getWatchlistFeature(): Promise<WatchlistFeature> {
|
|
return createWatchlistFeature(watchlistContainer);
|
|
}
|