diff --git a/crm/docs/README.md b/crm/docs/README.md index 2d049cb2b..6d497f78f 100644 --- a/crm/docs/README.md +++ b/crm/docs/README.md @@ -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 diff --git a/crm/docs/src/spec.json b/crm/docs/src/spec.json index 0e7319aec..15f7e0688 100644 --- a/crm/docs/src/spec.json +++ b/crm/docs/src/spec.json @@ -211,7 +211,7 @@ ], "post": [ { - "type": "[]uint64", + "type": "[]string", "name": "pageIDs", "required": true, "title": "Page ID order" @@ -629,4 +629,4 @@ } ] } -] \ No newline at end of file +] diff --git a/crm/docs/src/spec/page.json b/crm/docs/src/spec/page.json index dc7ffe5da..b76be9522 100644 --- a/crm/docs/src/spec/page.json +++ b/crm/docs/src/spec/page.json @@ -160,7 +160,7 @@ "name": "pageIDs", "required": true, "title": "Page ID order", - "type": "[]uint64" + "type": "[]string" } ] } diff --git a/crm/rest/page.go b/crm/rest/page.go index 003907bdc..979ef5e2d 100644 --- a/crm/rest/page.go +++ b/crm/rest/page.go @@ -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) { diff --git a/crm/rest/request/page.go b/crm/rest/request/page.go index 57e979d93..4684d2828 100644 --- a/crm/rest/request/page.go +++ b/crm/rest/request/page.go @@ -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 }