1
0

Added pagination (#16)

This commit is contained in:
konrad
2018-11-09 10:30:17 +00:00
committed by Gitea
parent 0e7e1b7e38
commit d232836423
22 changed files with 71 additions and 31 deletions

View File

@ -53,7 +53,7 @@ func (n *Namespace) ReadOne() (err error) {
}
// ReadAll gets all namespaces a user has access to
func (n *Namespace) ReadAll(doer *User) (interface{}, error) {
func (n *Namespace) ReadAll(doer *User, page int) (interface{}, error) {
type namespaceWithLists struct {
Namespace `xorm:"extends"`
@ -71,6 +71,7 @@ func (n *Namespace) ReadAll(doer *User) (interface{}, error) {
Or("namespaces.owner_id = ?", doer.ID).
Or("users_namespace.user_id = ?", doer.ID).
GroupBy("namespaces.id").
Limit(getLimitFromPageIndex(page)).
Find(&all)
if err != nil {