fix: Add only necessary information to executions (no-changelog) (#6916)

* fix: Add only necessary information to executions

* Fix lint

* fix: lint issue

---------

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Omar Ajoue
2023-08-14 09:44:04 +02:00
committed by GitHub
parent 808a92809e
commit 139e08a549
2 changed files with 13 additions and 3 deletions

View File

@@ -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 {
/**
@@ -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;
}