mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
feat: support team webhooks
This commit is contained in:
@ -2,24 +2,32 @@ import { z } from 'zod';
|
||||
|
||||
import { WebhookTriggerEvents } from '@documenso/prisma/client';
|
||||
|
||||
export const ZCreateWebhookFormSchema = z.object({
|
||||
export const ZGetTeamWebhooksQuerySchema = z.object({
|
||||
teamId: z.number(),
|
||||
});
|
||||
|
||||
export type TGetTeamWebhooksQuerySchema = z.infer<typeof ZGetTeamWebhooksQuerySchema>;
|
||||
|
||||
export const ZCreateWebhookMutationSchema = 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(),
|
||||
teamId: z.number().optional(),
|
||||
});
|
||||
|
||||
export type TCreateWebhookFormSchema = z.infer<typeof ZCreateWebhookFormSchema>;
|
||||
export type TCreateWebhookFormSchema = z.infer<typeof ZCreateWebhookMutationSchema>;
|
||||
|
||||
export const ZGetWebhookByIdQuerySchema = z.object({
|
||||
id: z.string(),
|
||||
teamId: z.number().optional(),
|
||||
});
|
||||
|
||||
export type TGetWebhookByIdQuerySchema = z.infer<typeof ZGetWebhookByIdQuerySchema>;
|
||||
|
||||
export const ZEditWebhookMutationSchema = ZCreateWebhookFormSchema.extend({
|
||||
export const ZEditWebhookMutationSchema = ZCreateWebhookMutationSchema.extend({
|
||||
id: z.string(),
|
||||
});
|
||||
|
||||
@ -27,6 +35,7 @@ export type TEditWebhookMutationSchema = z.infer<typeof ZEditWebhookMutationSche
|
||||
|
||||
export const ZDeleteWebhookMutationSchema = z.object({
|
||||
id: z.string(),
|
||||
teamId: z.number().optional(),
|
||||
});
|
||||
|
||||
export type TDeleteWebhookMutationSchema = z.infer<typeof ZDeleteWebhookMutationSchema>;
|
||||
|
||||
Reference in New Issue
Block a user