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, payloadTemplate: true,
}).partial(); }).partial();
// const schemaWebhookCreateParams = z export const schemaWebhookCreateParams = z
// .object({ .object({
// id: z.string(), userId: z.number().or(z.string()).optional(),
// subscriberUrl: z.string(), eventTypeId: z.number().or(z.string()).optional(),
// }) eventTriggers: z.any.optional(),
// .strict(); active: z.boolean().optional(),
subscriberUrl: z.string(),
payloadTemplate: z.string().optional(),
})
.strict();
export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge( export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge(
z.object({ schemaWebhookCreateParams
id: z.string(),
subscriberUrl: z.string(),
})
); );
// 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( export const schemaWebhookEditBodyParams = schemaWebhookBaseBodyParams.merge(
z.object({ z.object({
payloadTemplate: z.string().optional(), payloadTemplate: z.string().optional(),