Fixed route search in admin
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user