Added schema for create

pull/9078/head
Syed Ali Shahbaz 2022-05-25 14:23:43 +05:30 committed by Agusti Fernandez Pardo
parent a945d5a61c
commit fe3f6a70f3
1 changed files with 11 additions and 19 deletions

View File

@ -12,29 +12,21 @@ const schemaWebhookBaseBodyParams = Webhook.pick({
payloadTemplate: true,
}).partial();
// const schemaWebhookCreateParams = z
// .object({
// id: z.string(),
// subscriberUrl: z.string(),
// })
// .strict();
export const schemaWebhookCreateParams = z
.object({
userId: z.number().or(z.string()).optional(),
eventTypeId: z.number().or(z.string()).optional(),
eventTriggers: z.any.optional(),
active: z.boolean().optional(),
subscriberUrl: z.string(),
payloadTemplate: z.string().optional(),
})
.strict();
export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge(
z.object({
id: z.string(),
subscriberUrl: z.string(),
})
schemaWebhookCreateParams
);
// const schemaWebhookEditParams = z
// .object({
// payloadTemplate: z.string().optional(),
// /** @todo: don't use any here and validate eventTriggers proper */
// eventTriggers: z.any(),
// subscriberUrl: z.string().optional(),
// })
// .strict();
export const schemaWebhookEditBodyParams = schemaWebhookBaseBodyParams.merge(
z.object({
payloadTemplate: z.string().optional(),