3
0

Add []namespaceID to ComposeNamespace filter

This commit is contained in:
Tomaž Jerman
2021-06-10 14:27:39 +02:00
parent 02c6345e8e
commit 21a3c5e620
2 changed files with 10 additions and 4 deletions
+4 -3
View File
@@ -28,9 +28,10 @@ type (
}
NamespaceFilter struct {
Query string `json:"query"`
Slug string `json:"slug"`
Name string `json:"name"`
NamespaceID []uint64 `json:"namespaceID"`
Query string `json:"query"`
Slug string `json:"slug"`
Name string `json:"name"`
LabeledIDs []uint64 `json:"-"`
Labels map[string]string `json:"labels,omitempty"`
+6 -1
View File
@@ -1,10 +1,11 @@
package rdbms
import (
"strings"
"github.com/Masterminds/squirrel"
"github.com/cortezaproject/corteza-server/compose/types"
"github.com/cortezaproject/corteza-server/pkg/filter"
"strings"
)
func (s Store) convertComposeNamespaceFilter(f types.NamespaceFilter) (query squirrel.SelectBuilder, err error) {
@@ -12,6 +13,10 @@ func (s Store) convertComposeNamespaceFilter(f types.NamespaceFilter) (query squ
query = filter.StateCondition(query, "cns.deleted_at", f.Deleted)
if len(f.NamespaceID) > 0 {
query = query.Where(squirrel.Eq{"cns.id": f.NamespaceID})
}
if len(f.LabeledIDs) > 0 {
query = query.Where(squirrel.Eq{"cns.id": f.LabeledIDs})
}