mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-07 09:49:41 +09:00
Adds support for paging in admin/hooks api endpoint fixes: https://github.com/go-gitea/gitea/issues/36516 --------- Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: techknowlogick <matti@mdranta.net>
19 lines
499 B
Go
19 lines
499 B
Go
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package utils
|
|
|
|
import (
|
|
"code.gitea.io/gitea/models/db"
|
|
"code.gitea.io/gitea/services/context"
|
|
"code.gitea.io/gitea/services/convert"
|
|
)
|
|
|
|
// GetListOptions returns list options using the page and limit parameters
|
|
func GetListOptions(ctx *context.APIContext) db.ListOptions {
|
|
return db.ListOptions{
|
|
Page: max(ctx.FormInt("page"), 1),
|
|
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
|
}
|
|
}
|