chore: Add initial webhook wiring (TRPC handlers) to the new architecture (#27170)
* --init * clean up * unnecessary comment * remove comment * fix factory resolver * Add active filter to webhook query
This commit is contained in:
1 parent
646d18e286
commit
4115eaacbd
14 files changed
+142
-77
No files matched your search
@@ -2,7 +2,7 @@ import type { IWebhookDataFetcher } from "@calcom/features/webhooks/lib/interfac
|
||||
import type { IWebhookRepository } from "@calcom/features/webhooks/lib/interface/IWebhookRepository";
|
||||
import type { ILogger } from "@calcom/features/webhooks/lib/interface/infrastructure";
|
||||
import { WebhookTaskConsumer } from "@calcom/features/webhooks/lib/service/WebhookTaskConsumer";
|
||||
import type { Container } from "@evyweb/ioctopus";
|
||||
import type { ResolveFunction } from "@evyweb/ioctopus";
|
||||
import { createModule } from "@evyweb/ioctopus";
|
||||
import { SHARED_TOKENS } from "../../shared/shared.tokens";
|
||||
import { WEBHOOK_TOKENS } from "../Webhooks.tokens";
|
||||
@@ -18,16 +18,16 @@ import { WEBHOOK_TOKENS } from "../Webhooks.tokens";
|
||||
*/
|
||||
export const webhookTaskConsumerModule = createModule();
|
||||
|
||||
webhookTaskConsumerModule.bind(WEBHOOK_TOKENS.WEBHOOK_TASK_CONSUMER).toFactory((container: Container) => {
|
||||
const webhookRepository = container.get<IWebhookRepository>(WEBHOOK_TOKENS.WEBHOOK_REPOSITORY);
|
||||
webhookTaskConsumerModule.bind(WEBHOOK_TOKENS.WEBHOOK_TASK_CONSUMER).toFactory((resolve: ResolveFunction) => {
|
||||
const webhookRepository = resolve(WEBHOOK_TOKENS.WEBHOOK_REPOSITORY) as IWebhookRepository;
|
||||
const dataFetchers: IWebhookDataFetcher[] = [
|
||||
container.get<IWebhookDataFetcher>(WEBHOOK_TOKENS.BOOKING_DATA_FETCHER),
|
||||
container.get<IWebhookDataFetcher>(WEBHOOK_TOKENS.PAYMENT_DATA_FETCHER),
|
||||
container.get<IWebhookDataFetcher>(WEBHOOK_TOKENS.FORM_DATA_FETCHER),
|
||||
container.get<IWebhookDataFetcher>(WEBHOOK_TOKENS.RECORDING_DATA_FETCHER),
|
||||
container.get<IWebhookDataFetcher>(WEBHOOK_TOKENS.OOO_DATA_FETCHER),
|
||||
resolve(WEBHOOK_TOKENS.BOOKING_DATA_FETCHER) as IWebhookDataFetcher,
|
||||
resolve(WEBHOOK_TOKENS.PAYMENT_DATA_FETCHER) as IWebhookDataFetcher,
|
||||
resolve(WEBHOOK_TOKENS.FORM_DATA_FETCHER) as IWebhookDataFetcher,
|
||||
resolve(WEBHOOK_TOKENS.RECORDING_DATA_FETCHER) as IWebhookDataFetcher,
|
||||
resolve(WEBHOOK_TOKENS.OOO_DATA_FETCHER) as IWebhookDataFetcher,
|
||||
];
|
||||
const logger = container.get<ILogger>(SHARED_TOKENS.LOGGER);
|
||||
const logger = resolve(SHARED_TOKENS.LOGGER) as ILogger;
|
||||
|
||||
return new WebhookTaskConsumer(webhookRepository, dataFetchers, logger);
|
||||
});
|
||||
Reference in new issue
Block a user