Fixed route search in admin

This commit is contained in:
Peter Grlica
2022-05-16 15:53:57 +02:00
parent e6a0b0f659
commit 5ddddf8121
3 changed files with 8 additions and 1 deletions
+6
View File
@@ -1,6 +1,8 @@
package rdbms
import (
"strings"
"github.com/Masterminds/squirrel"
"github.com/cortezaproject/corteza-server/pkg/filter"
"github.com/cortezaproject/corteza-server/system/types"
@@ -11,5 +13,9 @@ func (s Store) convertApigwRouteFilter(f types.ApigwRouteFilter) (query squirrel
query = filter.StateCondition(query, "ar.deleted_at", f.Deleted)
query = filter.StateConditionNegBool(query, "ar.enabled", f.Disabled)
if f.Query != "" {
query = query.Where(squirrel.Like{"LOWER(ar.endpoint)": "%" + strings.ToLower(f.Query) + "%"})
}
return
}
+1
View File
@@ -46,6 +46,7 @@ func (ctrl *ApigwRoute) List(ctx context.Context, r *request.ApigwRouteList) (in
var (
err error
f = types.ApigwRouteFilter{
Query: r.Query,
Deleted: filter.State(r.Deleted),
// todo: this should dynamic as Delete
+1 -1
View File
@@ -33,7 +33,7 @@ type (
ApigwRouteFilter struct {
Route string `json:"route"`
Group string `json:"group"`
Query string `json:"query"`
Deleted filter.State `json:"deleted"`
Disabled filter.State `json:"disabled"`