refactor(core): Continue moving typeorm operators to repositories (no-changelog) (#8212)

Follow-up to: https://github.com/n8n-io/n8n/pull/8186
This commit is contained in:
Iván Ovejero
2024-01-05 13:06:24 +01:00
committed by GitHub
parent bed04ec122
commit 23a4ac96c0
10 changed files with 69 additions and 47 deletions

View File

@@ -35,6 +35,7 @@ import { WorkflowRepository } from '@/databases/repositories/workflow.repository
import type { RoleNames } from '@/databases/entities/Role';
import { UnauthorizedError } from '@/errors/response-errors/unauthorized.error';
import { CredentialsService } from '../credentials/credentials.service';
import { UserRepository } from '@/databases/repositories/user.repository';
export const workflowsController = express.Router();
@@ -428,7 +429,10 @@ workflowsController.put(
);
if (newShareeIds.length) {
await Container.get(EnterpriseWorkflowService).share(trx, workflow!, newShareeIds);
const users = await Container.get(UserRepository).getByIds(trx, newShareeIds);
const role = await Container.get(RoleService).findWorkflowEditorRole();
await Container.get(SharedWorkflowRepository).share(trx, workflow!, users, role.id);
}
});