From ab0778e049ac3690e2d714332ac896452fb34364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 13 Apr 2021 18:41:52 +0200 Subject: [PATCH] :hammer: Simplify workflow tags retrieval --- packages/cli/src/TagHelpers.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/TagHelpers.ts b/packages/cli/src/TagHelpers.ts index f63f55c6a6..f30a5acb43 100644 --- a/packages/cli/src/TagHelpers.ts +++ b/packages/cli/src/TagHelpers.ts @@ -127,18 +127,13 @@ export async function getAllTagsWithUsageCount(): Promise> { - return await getConnection().createQueryBuilder() + return await getConnection() + .createQueryBuilder() .select('tag_entity.id', 'id') .addSelect('tag_entity.name', 'name') .from('tag_entity', 'tag_entity') - .where(qb => { - return "id IN " + qb.subQuery() - .select('tagId') - .from('workflow_entity', 'workflow_entity') - .leftJoin('workflows_tags', 'workflows_tags', 'workflows_tags.workflowId = workflow_entity.id') - .where("workflow_entity.id = :id", { id: workflowId }) - .getQuery(); - }) + .leftJoin('workflows_tags', 'workflows_tags', 'workflows_tags.tagId = tag_entity.id') + .where('workflowId = :workflowId', { workflowId }) .getRawMany(); }