Files
calendar/packages/trpc/server/routers/viewer/webhook/get.handler.ts
T
7e557889b6 feat: support for platform wide webhooks (#14092)
* db migration

* adjusted ui to include `platform` in dropdown for admin webhooks

* adjusted webhook/create.handler for platform

* adjusted `edit.handler` so that only ADMIN can update `platform` webhooks

* update `getWebhooks` for platform wide webhooks

* list platform webhooks if admin

* createFunction refactor

* update subscriberUrlReserved for platform webhooks

* fix delete webhook handler

* fix: added readOnly to WebhookListItem

* fix: admin cannot delete its own webhooks

* fix: ts error

---------

Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
2024-03-18 13:42:28 -04:00

31 lines
665 B
TypeScript

import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
import type { TGetInputSchema } from "./get.schema";
type GetOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TGetInputSchema;
};
export const getHandler = async ({ ctx: _ctx, input }: GetOptions) => {
return await prisma.webhook.findUniqueOrThrow({
where: {
id: input.webhookId,
},
select: {
id: true,
subscriberUrl: true,
payloadTemplate: true,
active: true,
eventTriggers: true,
secret: true,
teamId: true,
userId: true,
platform: true,
},
});
};