refactor(core): Inject dependencies into workflow services (no-changelog) (#8066)

Inject dependencies into workflow services (no-changelog)

Up next:

- ~~Make workflow services injectable~~ #8033
- ~~Inject dependencies into workflow services~~ (current)
- Consolidate workflow controllers into one
- Make workflow controller injectable
- Inject dependencies into workflow controller
This commit is contained in:
Iván Ovejero
2023-12-18 16:10:30 +01:00
committed by GitHub
parent a651089a10
commit 73d400a1bf
8 changed files with 127 additions and 80 deletions

View File

@@ -6,6 +6,7 @@ import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces
import { EnterpriseWorkflowService } from '../workflows/workflow.service.ee';
import type { WorkflowWithSharingsAndCredentials } from '@/workflows/workflows.types';
import Container from 'typedi';
import { WorkflowService } from '@/workflows/workflow.service';
export class EEExecutionsService extends ExecutionsService {
/**
@@ -24,14 +25,15 @@ export class EEExecutionsService extends ExecutionsService {
if (!execution) return;
const relations = ['shared', 'shared.user', 'shared.role'];
const enterpriseWorkflowService = Container.get(EnterpriseWorkflowService);
const workflow = (await enterpriseWorkflowService.get(
const workflow = (await Container.get(WorkflowService).get(
{ id: execution.workflowId },
{ relations },
)) as WorkflowWithSharingsAndCredentials;
if (!workflow) return;
const enterpriseWorkflowService = Container.get(EnterpriseWorkflowService);
enterpriseWorkflowService.addOwnerAndSharings(workflow);
await enterpriseWorkflowService.addCredentialsToWorkflow(workflow, req.user);