Skip to content

Commit

Permalink
fix(core): Fix Filtering of Workflow by Tags (#5570)
Browse files Browse the repository at this point in the history
  • Loading branch information
cstuncsik committed Feb 27, 2023
1 parent 1942fd8 commit ea2035b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cli/src/workflows/workflows.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class WorkflowsService {

if (!config.getEnv('workflowTagsDisabled')) {
relations.push('tags');
select.tags = { name: true };
select.tags = { id: true, name: true };
}

if (isSharingEnabled()) {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/test/integration/shared/testDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ export async function createManyWorkflows(

/**
* Store a workflow in the DB (without a trigger) and optionally assign it to a user.
* @param attributes workflow attributes
* @param user user to assign the workflow to
*/
export async function createWorkflow(attributes: Partial<WorkflowEntity> = {}, user?: User) {
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/test/integration/workflows.controller.ee.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ describe('GET /workflows', () => {
test('should return workflows without nodes, sharing and credential usage details', async () => {
const owner = await testDb.createUser({ globalRole: globalOwnerRole });
const member = await testDb.createUser({ globalRole: globalMemberRole });
const tag = await testDb.createTag({ name: 'test' });

const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });

Expand All @@ -175,6 +176,7 @@ describe('GET /workflows', () => {
},
},
],
tags: [tag],
},
owner,
);
Expand All @@ -193,6 +195,14 @@ describe('GET /workflows', () => {
expect(fetchedWorkflow.sharedWith).not.toBeDefined()
expect(fetchedWorkflow.usedCredentials).not.toBeDefined()
expect(fetchedWorkflow.nodes).not.toBeDefined()
expect(fetchedWorkflow.tags).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: expect.any(String),
name: expect.any(String)
})
])
)
});
});

Expand Down

0 comments on commit ea2035b

Please sign in to comment.