From f9e98228c763ca4ed525596259c076d989d6c6e4 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Fri, 20 May 2022 21:48:24 +0200 Subject: [PATCH] merge directly --- lib/validations/webhook.ts | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/validations/webhook.ts b/lib/validations/webhook.ts index e3ea709ec9..fd95d5ed8c 100644 --- a/lib/validations/webhook.ts +++ b/lib/validations/webhook.ts @@ -12,25 +12,37 @@ const schemaWebhookBaseBodyParams = Webhook.pick({ payloadTemplate: true, }).partial(); -const schemaWebhookCreateParams = z - .object({ +// const schemaWebhookCreateParams = z +// .object({ +// id: z.string(), +// subscriberUrl: z.string(), +// }) +// .strict(); + +export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge( + z.object({ id: z.string(), subscriberUrl: z.string(), }) - .strict(); +); -export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge(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(); -const schemaWebhookEditParams = z - .object({ +export const schemaWebhookEditBodyParams = schemaWebhookBaseBodyParams.merge( + 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(schemaWebhookEditParams); +); export const schemaWebhookReadPublic = Webhook.pick({ id: true,