Added schema for create

pull/9078/head
Syed Ali Shahbaz 2022-05-25 14:23:43 +05:30 committed by GitHub
parent 0e95a1d3e8
commit 2e22978838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(),