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

@ -1,7 +1,7 @@
package models
// ReadAll implements the method to read all teams of a list
func (tl *TeamList) ReadAll(u *User) (interface{}, error) {
func (tl *TeamList) ReadAll(u *User, page int) (interface{}, error) {
// Check if the user can read the namespace
l := &List{ID: tl.ListID}
if err := l.GetSimpleByID(); err != nil {
@ -17,6 +17,7 @@ func (tl *TeamList) ReadAll(u *User) (interface{}, error) {
Table("teams").
Join("INNER", "team_list", "team_id = teams.id").
Where("team_list.list_id = ?", tl.ListID).
Limit(getLimitFromPageIndex(page)).
Find(&all)
return all, err