fix: webhooks upgraded to new version, need to update templates

This commit is contained in:
Agusti Fernandez Pardo committed 2022-05-11 15:57:00 +02:00
1 parent 982c32e92c
commit 7deb5f8e1f
8 files changed
+71 -31

No files matched your search

+40 -2
View File
@@ -1,5 +1,43 @@
import { z } from "zod";
import { _WebhookModel as Webhook } from "@calcom/prisma/zod";
export const schemaWebhookBodyParams = Webhook.omit({ id: true }).partial();
const schemaWebhookBaseBodyParams = Webhook.pick({
id: true,
userId: true,
eventTypeId: true,
eventTriggers: true,
active: true,
subscriberUrl: true,
payloadTemplate: true,
}).partial();
export const schemaWebhookPublic = Webhook.omit({});
const schemaWebhookCreateParams = z
.object({
id: z.string(),
subscriberUrl: z.string(),
})
.strict();
export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge(schemaWebhookCreateParams);
const schemaWebhookEditParams = z
.object({
uid: z.string().optional(),
title: z.string().optional(),
startTime: z.date().optional(),
endTime: z.date().optional(),
})
.strict();
export const schemaWebhookEditBodyParams = schemaWebhookBaseBodyParams.merge(schemaWebhookEditParams);
export const schemaWebhookReadPublic = Webhook.pick({
id: true,
userId: true,
eventTypeId: true,
uid: true,
title: true,
startTime: true,
endTime: true,
});