From 4bcb22652398facf2b876cdeee2af7e513db3525 Mon Sep 17 00:00:00 2001 From: martmull Date: Wed, 11 Sep 2024 14:19:07 +0200 Subject: [PATCH] Code review return: update naming --- .../workflow/common/types/workflow-step-result.type.ts | 2 +- .../workflow-executor.workspace-service.ts | 8 ++++---- .../factories/code.workflow-step-executor.ts | 2 +- .../factories/send-email.workflow-step-executor.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts index 243d1e5e6a65..3b6c765284f4 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts @@ -5,6 +5,6 @@ type WorkflowError = { }; export type WorkflowStepResult = { - data?: object; + result?: object; error?: WorkflowError; }; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts index b157a8d14cf2..2db39c643c9b 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts @@ -10,7 +10,7 @@ import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-step- const MAX_RETRIES_ON_FAILURE = 3; export type WorkflowExecutionOutput = { - data?: object; + result?: object; error?: object; }; @@ -33,7 +33,7 @@ export class WorkflowExecutorWorkspaceService { }): Promise { if (currentStepIndex >= steps.length) { return { - data: payload, + result: payload, }; } @@ -48,11 +48,11 @@ export class WorkflowExecutorWorkspaceService { payload, }); - if (result.data) { + if (result.result) { return await this.execute({ currentStepIndex: currentStepIndex + 1, steps, - payload: result.data, + payload: result.result, }); } diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts index 594d40211c5e..7ad62808c433 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts @@ -43,6 +43,6 @@ export class CodeWorkflowStepExecutor { return { error: result.error }; } - return { data: result.data || {} }; + return { result: result.data || {} }; } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts index 26e9780f68ba..610f17e168d8 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts @@ -38,7 +38,7 @@ export class SendEmailWorkflowStepExecutor { if (!result.success) { this.logger.warn(`Email '${payload.email}' invalid`); - return { data: { success: false } }; + return { result: { success: false } }; } const mainText = Handlebars.compile(step.settings.template)(payload); @@ -69,7 +69,7 @@ export class SendEmailWorkflowStepExecutor { html, }); - return { data: { success: true } }; + return { result: { success: true } }; } catch (error) { return { error }; }