Added pagination (#16)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
package models
|
||||
|
||||
// ReadAll implements the method to read all teams of a namespace
|
||||
func (tn *TeamNamespace) ReadAll(user *User) (interface{}, error) {
|
||||
func (tn *TeamNamespace) ReadAll(user *User, page int) (interface{}, error) {
|
||||
// Check if the user can read the namespace
|
||||
n, err := GetNamespaceByID(tn.NamespaceID)
|
||||
if err != nil {
|
||||
@ -17,6 +17,7 @@ func (tn *TeamNamespace) ReadAll(user *User) (interface{}, error) {
|
||||
err = x.Table("teams").
|
||||
Join("INNER", "team_namespaces", "team_id = teams.id").
|
||||
Where("team_namespaces.namespace_id = ?", tn.NamespaceID).
|
||||
Limit(getLimitFromPageIndex(page)).
|
||||
Find(&all)
|
||||
|
||||
return all, err
|
||||
|
Reference in New Issue
Block a user