3
0

Added sorting fields to integration gateway

This commit is contained in:
Peter Grlica
2021-10-18 12:07:54 +02:00
parent e2e7510c07
commit c388f893c1
2 changed files with 25 additions and 6 deletions
+5 -5
View File
@@ -8,17 +8,17 @@ types:
fields:
- { field: ID, sortable: false }
- { field: Endpoint }
- { field: Method }
- { field: Endpoint, sortable: true }
- { field: Method, sortable: true }
- { field: Enabled }
- { field: Group }
- { field: Meta, type: "types.ApigwRouteMeta" }
- { field: CreatedBy }
- { field: UpdatedBy }
- { field: DeletedBy }
- { field: CreatedAt }
- { field: UpdatedAt }
- { field: DeletedAt }
- { field: CreatedAt, sortable: true }
- { field: UpdatedAt, sortable: true }
- { field: DeletedAt, sortable: true }
lookups:
- fields: [ ID ]
+20 -1
View File
@@ -482,7 +482,12 @@ func (Store) apigwRouteColumns(aa ...string) []string {
// With optional string arg, all columns are returned aliased
func (Store) sortableApigwRouteColumns() map[string]string {
return map[string]string{
"id": "id",
"id": "id", "endpoint": "endpoint", "method": "method", "created_at": "created_at",
"createdat": "created_at",
"updated_at": "updated_at",
"updatedat": "updated_at",
"deleted_at": "deleted_at",
"deletedat": "deleted_at",
}
}
@@ -533,6 +538,20 @@ func (s Store) collectApigwRouteCursorValues(res *types.ApigwRoute, cc ...*filte
cursor.Set(c.Column, res.ID, c.Descending)
pkId = true
case "endpoint":
cursor.Set(c.Column, res.Endpoint, c.Descending)
case "method":
cursor.Set(c.Column, res.Method, c.Descending)
case "created_at":
cursor.Set(c.Column, res.CreatedAt, c.Descending)
case "updated_at":
cursor.Set(c.Column, res.UpdatedAt, c.Descending)
case "deleted_at":
cursor.Set(c.Column, res.DeletedAt, c.Descending)
}
}