Skip to content

Commit

Permalink
fix: Add only necessary information to executions (no-changelog) (#6916)
Browse files Browse the repository at this point in the history
* fix: Add only necessary information to executions

* Fix lint

* fix: lint issue

---------

Co-authored-by: Iván Ovejero <[email protected]>
  • Loading branch information
2 people authored and netroy committed Aug 14, 2023
1 parent a3f5bca commit 174f191
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import type {
WorkflowTagMappingRepository,
} from '@db/repositories';
import type { LICENSE_FEATURES, LICENSE_QUOTAS } from './constants';
import type { WorkflowWithSharingsAndCredentials } from './workflows/workflows.types';

export interface IActivationError {
time: number;
Expand Down Expand Up @@ -194,7 +195,7 @@ export interface IExecutionResponse extends IExecutionBase {
retryOf?: string;
retrySuccessId?: string;
waitTill?: Date | null;
workflowData: IWorkflowBase;
workflowData: IWorkflowBase | WorkflowWithSharingsAndCredentials;
}

// Flatted data to save memory when saving in database or transferring
Expand Down
13 changes: 11 additions & 2 deletions packages/cli/src/executions/executions.service.ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ExecutionsService } from './executions.service';
import type { ExecutionRequest } from '@/requests';
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces';
import { EEWorkflowsService as EEWorkflows } from '../workflows/workflows.services.ee';
import type { WorkflowWithSharingsAndCredentials } from '@/workflows/workflows.types';

export class EEExecutionsService extends ExecutionsService {
/**
Expand All @@ -22,13 +23,21 @@ export class EEExecutionsService extends ExecutionsService {
if (!execution) return;

const relations = ['shared', 'shared.user', 'shared.role'];
const workflow = await EEWorkflows.get({ id: execution.workflowId }, { relations });
const workflow = (await EEWorkflows.get(
{ id: execution.workflowId },
{ relations },
)) as WorkflowWithSharingsAndCredentials;
if (!workflow) return;

EEWorkflows.addOwnerAndSharings(workflow);
await EEWorkflows.addCredentialsToWorkflow(workflow, req.user);

execution.workflowData = workflow;
execution.workflowData = {
...execution.workflowData,
ownedBy: workflow.ownedBy,
sharedWith: workflow.sharedWith,
usedCredentials: workflow.usedCredentials,
} as WorkflowWithSharingsAndCredentials;

return execution;
}
Expand Down

0 comments on commit 174f191

Please sign in to comment.