Skip to content

Commit

Permalink
fix up paging
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmethurst committed Apr 30, 2024
1 parent 17e6512 commit b6f594a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 1 addition & 8 deletions internal/api/client/admin/accountsgetv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,12 @@ func (m *Module) AccountsGETV1Handler(c *gin.Context) {
return
}

limit, errWithCode := apiutil.ParseLimit(c.Query(apiutil.LimitKey), 1, 200, 50)
page, errWithCode := paging.ParseIDPage(c, 1, 200, 50)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}

// Use min / max for paging.
page := &paging.Page{
Min: paging.MinID(c.Query(apiutil.MinIDKey)),
Max: paging.MaxID(c.Query(apiutil.MaxIDKey)),
Limit: limit,
}

/* Translate to v2 `origin` query param */

local, errWithCode := apiutil.ParseLocal(c.Query(apiutil.LocalKey), false)
Expand Down
9 changes: 1 addition & 8 deletions internal/api/client/admin/accountsgetv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,12 @@ func (m *Module) AccountsGETV2Handler(c *gin.Context) {
return
}

limit, errWithCode := apiutil.ParseLimit(c.Query(apiutil.LimitKey), 1, 200, 50)
page, errWithCode := paging.ParseIDPage(c, 1, 200, 50)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}

// Use min / max for paging.
page := &paging.Page{
Min: paging.MinID(c.Query(apiutil.MinIDKey)),
Max: paging.MaxID(c.Query(apiutil.MaxIDKey)),
Limit: limit,
}

// Parse out all optional params from the query.
params := &apimodel.AdminGetAccountsRequest{
Origin: c.Query(apiutil.AdminOriginKey),
Expand Down

0 comments on commit b6f594a

Please sign in to comment.