Files
sign/packages/trpc/server/webhook-router/schema.ts

33 lines
967 B
TypeScript
Raw Normal View History

2024-02-09 16:07:33 +02:00
import { z } from 'zod';
import { WebhookTriggerEvents } from '@documenso/prisma/client';
export const ZCreateWebhookFormSchema = z.object({
webhookUrl: z.string().url(),
eventTriggers: z
.array(z.nativeEnum(WebhookTriggerEvents))
.min(1, { message: 'At least one event trigger is required' }),
secret: z.string().nullable(),
enabled: z.boolean(),
});
2024-02-14 14:38:58 +02:00
export const ZGetWebhookByIdQuerySchema = z.object({
id: z.number(),
});
export const ZEditWebhookMutationSchema = ZCreateWebhookFormSchema.extend({
id: z.number(),
});
export const ZDeleteWebhookMutationSchema = z.object({
2024-02-09 16:28:18 +02:00
id: z.number(),
});
2024-02-09 16:07:33 +02:00
export type TCreateWebhookFormSchema = z.infer<typeof ZCreateWebhookFormSchema>;
2024-02-09 16:28:18 +02:00
2024-02-14 14:38:58 +02:00
export type TGetWebhookByIdQuerySchema = z.infer<typeof ZGetWebhookByIdQuerySchema>;
export type TDeleteWebhookMutationSchema = z.infer<typeof ZDeleteWebhookMutationSchema>;
export type TEditWebhookMutationSchema = z.infer<typeof ZEditWebhookMutationSchema>;