* 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>
31 lines
665 B
TypeScript
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,
|
|
},
|
|
});
|
|
};
|