* --init * clean up * unnecessary comment * remove comment * fix factory resolver * Add active filter to webhook query
23 lines
692 B
TypeScript
23 lines
692 B
TypeScript
import { getWebhookFeature } from "@calcom/features/di/webhooks/containers/webhook";
|
|
import type { Webhook } from "@calcom/features/webhooks/lib/dto/types";
|
|
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
|
import type { TListInputSchema } from "./list.schema";
|
|
|
|
type ListOptions = {
|
|
ctx: {
|
|
user: NonNullable<TrpcSessionUser>;
|
|
};
|
|
input: TListInputSchema;
|
|
};
|
|
|
|
export const listHandler = async ({ ctx, input }: ListOptions): Promise<Webhook[]> => {
|
|
const { repository } = getWebhookFeature();
|
|
|
|
return repository.listWebhooks({
|
|
userId: ctx.user.id,
|
|
appId: input?.appId,
|
|
eventTypeId: input?.eventTypeId,
|
|
eventTriggers: input?.eventTriggers,
|
|
});
|
|
};
|