Switch back to []string (no support for unmarshaling to []uint64)
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
],
|
||||
"post": [
|
||||
{
|
||||
"type": "[]uint64",
|
||||
"type": "[]string",
|
||||
"name": "pageIDs",
|
||||
"required": true,
|
||||
"title": "Page ID order"
|
||||
@@ -629,4 +629,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
"name": "pageIDs",
|
||||
"required": true,
|
||||
"title": "Page ID order",
|
||||
"type": "[]uint64"
|
||||
"type": "[]string"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+2
-1
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user