refactor(core): Move tag collection into repository (no-changelog) (#6860)

* refactor(core): Move tag collection into repository

* Fix tests

* Address feedback

* Fix missing spot
This commit is contained in:
Iván Ovejero
2023-08-08 14:08:56 +02:00
committed by GitHub
parent 8de28fe4d0
commit 11440bfd3c
15 changed files with 59 additions and 61 deletions

View File

@@ -24,6 +24,7 @@ import { In } from 'typeorm';
import { Container } from 'typedi';
import { InternalHooks } from '@/InternalHooks';
import { RoleService } from '@/services/role.service';
import { TagRepository } from '@/databases/repositories';
export const workflowsController = express.Router();
@@ -62,7 +63,7 @@ workflowsController.post(
const { tags: tagIds } = req.body;
if (tagIds?.length && !config.getEnv('workflowTagsDisabled')) {
newWorkflow.tags = await Db.collections.Tag.find({
newWorkflow.tags = await Container.get(TagRepository).find({
select: ['id', 'name'],
where: {
id: In(tagIds),