Skip to content

Commit

Permalink
Code review return: update naming
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull committed Sep 11, 2024
1 parent 8fca876 commit 4bcb226
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ type WorkflowError = {
};

export type WorkflowStepResult = {
data?: object;
result?: object;
error?: WorkflowError;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -33,7 +33,7 @@ export class WorkflowExecutorWorkspaceService {
}): Promise<WorkflowExecutionOutput> {
if (currentStepIndex >= steps.length) {
return {
data: payload,
result: payload,
};
}

Expand All @@ -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,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ export class CodeWorkflowStepExecutor {
return { error: result.error };
}

return { data: result.data || {} };
return { result: result.data || {} };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -69,7 +69,7 @@ export class SendEmailWorkflowStepExecutor {
html,
});

return { data: { success: true } };
return { result: { success: true } };
} catch (error) {
return { error };
}
Expand Down

0 comments on commit 4bcb226

Please sign in to comment.