mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
refactor(core): Make workflow services injectable (no-changelog) (#8033)
Refactor static workflow service classes into DI-compatible classes Context: https://n8nio.slack.com/archives/C069HS026UF/p1702466571648889 Up next: - Inject dependencies into workflow services - Consolidate workflow controllers into one - Make workflow controller injectable - Inject dependencies into workflow controller --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -52,7 +52,7 @@ import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import { findSubworkflowStart, isWorkflowIdValid } from '@/utils';
|
||||
import { PermissionChecker } from './UserManagement/PermissionChecker';
|
||||
import { WorkflowsService } from './workflows/workflows.services';
|
||||
import { WorkflowService } from './workflows/workflow.service';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
import { ExecutionRepository } from '@db/repositories/execution.repository';
|
||||
import { EventsService } from '@/services/events.service';
|
||||
@@ -418,7 +418,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||
if (!isManualMode && isWorkflowIdValid(this.workflowData.id) && newStaticData) {
|
||||
// Workflow is saved so update in database
|
||||
try {
|
||||
await WorkflowsService.saveStaticDataById(
|
||||
await Container.get(WorkflowService).saveStaticDataById(
|
||||
this.workflowData.id as string,
|
||||
newStaticData,
|
||||
);
|
||||
@@ -564,7 +564,7 @@ function hookFunctionsSaveWorker(): IWorkflowExecuteHooks {
|
||||
if (isWorkflowIdValid(this.workflowData.id) && newStaticData) {
|
||||
// Workflow is saved so update in database
|
||||
try {
|
||||
await WorkflowsService.saveStaticDataById(
|
||||
await Container.get(WorkflowService).saveStaticDataById(
|
||||
this.workflowData.id as string,
|
||||
newStaticData,
|
||||
);
|
||||
@@ -714,7 +714,7 @@ export async function getWorkflowData(
|
||||
if (workflowInfo.id !== undefined) {
|
||||
const relations = config.getEnv('workflowTagsDisabled') ? [] : ['tags'];
|
||||
|
||||
workflowData = await WorkflowsService.get({ id: workflowInfo.id }, { relations });
|
||||
workflowData = await Container.get(WorkflowService).get({ id: workflowInfo.id }, { relations });
|
||||
|
||||
if (workflowData === undefined || workflowData === null) {
|
||||
throw new ApplicationError('Workflow does not exist.', {
|
||||
|
||||
Reference in New Issue
Block a user