Files
calendar/packages/trpc/server/routers/viewer/webhook/create.schema.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

20 lines
665 B
TypeScript

import { z } from "zod";
import { WEBHOOK_TRIGGER_EVENTS } from "@calcom/features/webhooks/lib/constants";
import { webhookIdAndEventTypeIdSchema } from "./types";
export const ZCreateInputSchema = webhookIdAndEventTypeIdSchema.extend({
subscriberUrl: z.string().url(),
eventTriggers: z.enum(WEBHOOK_TRIGGER_EVENTS).array(),
active: z.boolean(),
payloadTemplate: z.string().nullable(),
eventTypeId: z.number().optional(),
appId: z.string().optional().nullable(),
secret: z.string().optional().nullable(),
teamId: z.number().optional(),
platform: z.boolean().optional(),
});
export type TCreateInputSchema = z.infer<typeof ZCreateInputSchema>;