Skip to content

Commit

Permalink
fix(workflow): Update workflow list query (chainloop-dev#1593)
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Rodriguez <[email protected]>
  • Loading branch information
javirln authored Nov 26, 2024
1 parent 2ab695c commit c48f39f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/controlplane/pkg/biz/workflow_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ func (s *workflowListIntegrationTestSuite) TestList() {
s.Len(workflows, 1)
})

s.Run("list workflows with description, workflow name and team filter", func() {
_, err := s.Workflow.Create(ctx, &biz.WorkflowCreateOpts{OrgID: s.org.ID, Name: "name1", Project: project, Team: team, Description: description})
require.NoError(s.T(), err)
_, 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"})
require.NoError(s.T(), err)

workflows, _, err := s.Workflow.List(ctx, s.org.ID, &biz.WorkflowListOpts{WorkflowName: "different", WorkflowDescription: "different", WorkflowTeam: "different"}, nil)
s.NoError(err)
s.Len(workflows, 1)
})

s.Run("list workflows with workflow team filter", func() {
_, err := s.Workflow.Create(ctx, &biz.WorkflowCreateOpts{OrgID: s.org.ID, Name: "name1", Project: project, Team: team, Description: description})
require.NoError(s.T(), err)
Expand Down
2 changes: 1 addition & 1 deletion app/controlplane/pkg/data/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func applyWorkflowFilters(wfQuery *ent.WorkflowQuery, opts *biz.WorkflowListOpts
}

if opts.WorkflowDescription != "" {
wfQuery = wfQuery.Where(workflow.DescriptionContains(opts.WorkflowDescription))
orConditions = append(orConditions, workflow.DescriptionContains(opts.WorkflowDescription))
}

if len(orConditions) > 0 {
Expand Down

0 comments on commit c48f39f

Please sign in to comment.