mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { WebhookTriggerEvents } from '@prisma/client';
|
|
import { z } from 'zod';
|
|
|
|
export const ZGetTeamWebhooksRequestSchema = z.object({
|
|
teamId: z.number(),
|
|
});
|
|
|
|
export type TGetTeamWebhooksRequestSchema = z.infer<typeof ZGetTeamWebhooksRequestSchema>;
|
|
|
|
export const ZCreateWebhookRequestSchema = 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(),
|
|
});
|
|
|
|
export type TCreateWebhookFormSchema = z.infer<typeof ZCreateWebhookRequestSchema>;
|
|
|
|
export const ZGetWebhookByIdRequestSchema = z.object({
|
|
id: z.string(),
|
|
teamId: z.number(),
|
|
});
|
|
|
|
export type TGetWebhookByIdRequestSchema = z.infer<typeof ZGetWebhookByIdRequestSchema>;
|
|
|
|
export const ZEditWebhookRequestSchema = ZCreateWebhookRequestSchema.extend({
|
|
id: z.string(),
|
|
});
|
|
|
|
export type TEditWebhookRequestSchema = z.infer<typeof ZEditWebhookRequestSchema>;
|
|
|
|
export const ZDeleteWebhookRequestSchema = z.object({
|
|
id: z.string(),
|
|
teamId: z.number(),
|
|
});
|
|
|
|
export type TDeleteWebhookRequestSchema = z.infer<typeof ZDeleteWebhookRequestSchema>;
|