From f40549e906615ca5d9617e17718619bf6570cc77 Mon Sep 17 00:00:00 2001 From: Alon Peretz <8467965+alonp99@users.noreply.github.com> Date: Mon, 9 Sep 2024 21:35:59 +0300 Subject: [PATCH] chore(wf-types): config and webhookd examples --- .../src/workflow/dtos/workflow-run.ts | 9 +++++++++ .../src/workflow/schemas/zod-schemas.ts | 11 +++++++++++ .../src/workflow/workflow.controller.external.ts | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/services/workflows-service/src/workflow/dtos/workflow-run.ts b/services/workflows-service/src/workflow/dtos/workflow-run.ts index e1aca14877..c9ce182039 100644 --- a/services/workflows-service/src/workflow/dtos/workflow-run.ts +++ b/services/workflows-service/src/workflow/dtos/workflow-run.ts @@ -52,6 +52,15 @@ export class WorkflowRunDto { required: false, type: 'object', description: 'Additional configuration for the workflow run.', + example: { + subscriptions: [ + { + type: 'webhook', + url: 'https://webhook.site/f82ea191-9d64-424f-887e-f84b8fcf4fe9', + events: ['workflow.completed'], + }, + ], + }, }) @IsObject() @IsOptional() diff --git a/services/workflows-service/src/workflow/schemas/zod-schemas.ts b/services/workflows-service/src/workflow/schemas/zod-schemas.ts index 94796a3b38..2885f47d55 100644 --- a/services/workflows-service/src/workflow/schemas/zod-schemas.ts +++ b/services/workflows-service/src/workflow/schemas/zod-schemas.ts @@ -68,3 +68,14 @@ export const ConfigSchema = z .optional(); export type WorkflowConfig = z.infer; + +export const CustomerConfigSchema = z.object({ + ongoingWorkflowDefinitionId: z.string().optional(), + hideCreateMerchantMonitoringButton: z.boolean().optional(), + isExample: z.boolean().optional(), + isMerchantMonitoringEnabled: z.boolean().optional(), + isDemo: z.boolean().optional(), + maxBusinessReports: z.number().optional(), +}); + +export type TCustomerConfig = z.infer; diff --git a/services/workflows-service/src/workflow/workflow.controller.external.ts b/services/workflows-service/src/workflow/workflow.controller.external.ts index 8e3d902822..9f414dbb5c 100644 --- a/services/workflows-service/src/workflow/workflow.controller.external.ts +++ b/services/workflows-service/src/workflow/workflow.controller.external.ts @@ -262,6 +262,15 @@ export class WorkflowControllerExternal { }, }, documents: [], + config: { + subscriptions: [ + { + type: 'webhook', + url: 'https://webhook.site/f82ea191-9d64-424f-887e-f8418faf4fe9', + events: ['workflow.completed'], + }, + ], + }, }, }, },