refactor(core): Use injectable classes for db repositories (part-1) (no-changelog) (#5953)
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
committed by
GitHub
parent
323e26acfd
commit
10f8c35dbb
@@ -11,6 +11,7 @@ import { isSharingEnabled, rightDiff } from '@/UserManagement/UserManagementHelp
|
||||
import { EEWorkflowsService as EEWorkflows } from './workflows.services.ee';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import { RoleRepository } from '@db/repositories';
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
import * as TagHelpers from '@/TagHelpers';
|
||||
import { EECredentialsService as EECredentials } from '../credentials/credentials.service.ee';
|
||||
@@ -162,10 +163,7 @@ EEWorkflowController.post(
|
||||
await Db.transaction(async (transactionManager) => {
|
||||
savedWorkflow = await transactionManager.save<WorkflowEntity>(newWorkflow);
|
||||
|
||||
const role = await Db.collections.Role.findOneByOrFail({
|
||||
name: 'owner',
|
||||
scope: 'workflow',
|
||||
});
|
||||
const role = await Container.get(RoleRepository).findWorkflowOwnerRoleOrFail();
|
||||
|
||||
const newSharedWorkflow = new SharedWorkflow();
|
||||
|
||||
@@ -206,10 +204,7 @@ EEWorkflowController.get(
|
||||
ResponseHelper.send(async (req: WorkflowRequest.GetAll) => {
|
||||
const [workflows, workflowOwnerRole] = await Promise.all([
|
||||
EEWorkflows.getMany(req.user, req.query.filter),
|
||||
Db.collections.Role.findOneOrFail({
|
||||
select: ['id'],
|
||||
where: { name: 'owner', scope: 'workflow' },
|
||||
}),
|
||||
Container.get(RoleRepository).findWorkflowOwnerRoleOrFail(),
|
||||
]);
|
||||
|
||||
return workflows.map((workflow) => {
|
||||
|
||||
Reference in New Issue
Block a user