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:
Syed Ali Shahbaz authored and GitHub committed 2026-01-23 16:50:34 +04:00
1 parent 646d18e286
commit 4115eaacbd
14 files changed
+142 -77

No files matched your search

@@ -1,6 +1,5 @@
import { WebhookRepository } from "@calcom/features/webhooks/lib/repository/WebhookRepository";
import { getWebhookFeature } from "@calcom/features/di/webhooks/containers/webhook";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
import type { TGetInputSchema } from "./get.schema";
type GetOptions = {
@@ -11,6 +10,6 @@ type GetOptions = {
};
export const getHandler = async ({ ctx: _ctx, input }: GetOptions) => {
const webhookRepository = WebhookRepository.getInstance();
const { repository: webhookRepository } = getWebhookFeature();
return await webhookRepository.findByWebhookId(input.webhookId);
};
@@ -1,5 +1,5 @@
import { getWebhookFeature } from "@calcom/features/di/webhooks/containers/webhook";
import type { WebhookGroup } from "@calcom/features/webhooks/lib/dto/types";
import { WebhookRepository } from "@calcom/features/webhooks/lib/repository/WebhookRepository";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
type GetByViewerOptions = {
@@ -21,7 +21,7 @@ export type WebhooksByViewer = {
export const getByViewerHandler = async ({ ctx }: GetByViewerOptions): Promise<WebhooksByViewer> => {
// Use the singleton instance to avoid creating new instances repeatedly
const webhookRepository = WebhookRepository.getInstance();
const { repository: webhookRepository } = getWebhookFeature();
return await webhookRepository.getFilteredWebhooksForUser({
userId: ctx.user.id,
userRole: ctx.user.role,
@@ -1,7 +1,6 @@
import { getWebhookFeature } from "@calcom/features/di/webhooks/containers/webhook";
import type { Webhook } from "@calcom/features/webhooks/lib/dto/types";
import { WebhookRepository } from "@calcom/features/webhooks/lib/repository/WebhookRepository";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
import type { TListInputSchema } from "./list.schema";
type ListOptions = {
@@ -12,7 +11,7 @@ type ListOptions = {
};
export const listHandler = async ({ ctx, input }: ListOptions): Promise<Webhook[]> => {
const repository = WebhookRepository.getInstance();
const { repository } = getWebhookFeature();
return repository.listWebhooks({
userId: ctx.user.id,