Switch back to []string (no support for unmarshaling to []uint64)

This commit is contained in:
Denis Arh
2018-11-20 12:05:29 +01:00
parent 8c488b83b0
commit 1116148b81
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -298,7 +298,7 @@ CRM module pages
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| selfID | uint64 | PATH | Parent page ID | N/A | YES |
| pageIDs | []uint64 | POST | Page ID order | N/A | YES |
| pageIDs | []string | POST | Page ID order | N/A | YES |
## Delete page
+2 -2
View File
@@ -211,7 +211,7 @@
],
"post": [
{
"type": "[]uint64",
"type": "[]string",
"name": "pageIDs",
"required": true,
"title": "Page ID order"
@@ -629,4 +629,4 @@
}
]
}
]
]
+1 -1
View File
@@ -160,7 +160,7 @@
"name": "pageIDs",
"required": true,
"title": "Page ID order",
"type": "[]uint64"
"type": "[]string"
}
]
}
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"github.com/crusttech/crust/crm/rest/request"
"github.com/crusttech/crust/crm/service"
"github.com/crusttech/crust/crm/types"
"github.com/crusttech/crust/internal/payload"
)
type (
@@ -41,7 +42,7 @@ func (ctrl *Page) Read(ctx context.Context, r *request.PageRead) (interface{}, e
}
func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interface{}, error) {
return resputil.OK(), ctrl.page.With(ctx).Reorder(r.SelfID, r.PageIDs)
return resputil.OK(), ctrl.page.With(ctx).Reorder(r.SelfID, payload.ParseUInt64s(r.PageIDs))
}
func (ctrl *Page) Edit(ctx context.Context, r *request.PageEdit) (interface{}, error) {
+2 -3
View File
@@ -269,8 +269,8 @@ var _ RequestFiller = NewPageEdit()
// Page reorder request parameters
type PageReorder struct {
SelfID uint64 `json:",string"`
PageIDs []uint64 `json:",string"`
SelfID uint64 `json:",string"`
PageIDs []string
}
func NewPageReorder() *PageReorder {
@@ -305,7 +305,6 @@ func (p *PageReorder) Fill(r *http.Request) (err error) {
}
p.SelfID = parseUInt64(chi.URLParam(r, "selfID"))
p.PageIDs = parseUInt64A(r.Form["pageIDs"])
return err
}