Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: support filtering no pipeline issues (#12025)

boojackc8595dfaf5ea
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index 9d4abc5d7f..24e673f985 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -282,6 +282,17 @@ func (s *IssueService) getIssueFind(ctx context.Context, permissionFilter *store
issueLabel := label
issueFind.LabelList = append(issueFind.LabelList, issueLabel)
}
+ case "has_pipeline":
+ if spec.operator != comparatorTypeEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for "%s" filter`, spec.key)
+ }
+ switch spec.value {
+ case "false":
+ issueFind.NoPipeline = true
+ case "true":
+ default:
+ return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid value %q for has_pipeline", spec.value))
+ }
}
}
diff --git a/backend/store/issue.go b/backend/store/issue.go
index f2775ec477..7536f473d4 100644
--- a/backend/store/issue.go
+++ b/backend/store/issue.go
@@ -114,6 +114,8 @@ type FindIssueMessage struct {
PermissionFilter *FindIssueMessagePermissionFilter
LabelList []string
+
+ NoPipeline bool
}
// GetIssueV2 gets issue by issue UID.
@@ -464,6 +466,9 @@ func (s *Store) ListIssueV2(ctx context.Context, find *FindIssueMessage) ([]*Iss
where = append(where, fmt.Sprintf("payload->'labels' ?& $%d::TEXT[]", len(args)+1))
args = append(args, find.LabelList)
}
+ if find.NoPipeline {
+ where = append(where, "issue.pipeline_id IS NULL")
+ }
var issues []*IssueMessage
tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})