Skip to content

Commit c48f39f

Browse files
authored
fix(workflow): Update workflow list query (#1593)
Signed-off-by: Javier Rodriguez <[email protected]>
1 parent 2ab695c commit c48f39f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

app/controlplane/pkg/biz/workflow_integration_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,17 @@ func (s *workflowListIntegrationTestSuite) TestList() {
380380
s.Len(workflows, 1)
381381
})
382382

383+
s.Run("list workflows with description, workflow name and team filter", func() {
384+
_, err := s.Workflow.Create(ctx, &biz.WorkflowCreateOpts{OrgID: s.org.ID, Name: "name1", Project: project, Team: team, Description: description})
385+
require.NoError(s.T(), err)
386+
_, err = s.Workflow.Create(ctx, &biz.WorkflowCreateOpts{OrgID: s.org.ID, Name: "name2", Project: project, Team: team, Description: "this is a different description for workflow"})
387+
require.NoError(s.T(), err)
388+
389+
workflows, _, err := s.Workflow.List(ctx, s.org.ID, &biz.WorkflowListOpts{WorkflowName: "different", WorkflowDescription: "different", WorkflowTeam: "different"}, nil)
390+
s.NoError(err)
391+
s.Len(workflows, 1)
392+
})
393+
383394
s.Run("list workflows with workflow team filter", func() {
384395
_, err := s.Workflow.Create(ctx, &biz.WorkflowCreateOpts{OrgID: s.org.ID, Name: "name1", Project: project, Team: team, Description: description})
385396
require.NoError(s.T(), err)

app/controlplane/pkg/data/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func applyWorkflowFilters(wfQuery *ent.WorkflowQuery, opts *biz.WorkflowListOpts
243243
}
244244

245245
if opts.WorkflowDescription != "" {
246-
wfQuery = wfQuery.Where(workflow.DescriptionContains(opts.WorkflowDescription))
246+
orConditions = append(orConditions, workflow.DescriptionContains(opts.WorkflowDescription))
247247
}
248248

249249
if len(orConditions) > 0 {

0 commit comments

Comments
 (0)