Continue working on new admin pages

This commit is contained in:
Unknwon
2014-08-29 20:50:43 +08:00
parent 904bf1a50b
commit d2aff9a46a
27 changed files with 669 additions and 539 deletions

View File

@ -165,6 +165,13 @@ func CountOrganizations() int64 {
return count
}
// GetOrganizations returns given number of organizations with offset.
func GetOrganizations(num, offset int) ([]*User, error) {
orgs := make([]*User, 0, num)
err := x.Limit(num, offset).Where("type=1").Asc("id").Find(&orgs)
return orgs, err
}
// TODO: need some kind of mechanism to record failure.
// DeleteOrganization completely and permanently deletes everything of organization.
func DeleteOrganization(org *User) (err error) {

View File

@ -248,8 +248,8 @@ func CountUsers() int64 {
}
// GetUsers returns given number of user objects with offset.
func GetUsers(num, offset int) ([]User, error) {
users := make([]User, 0, num)
func GetUsers(num, offset int) ([]*User, error) {
users := make([]*User, 0, num)
err := x.Limit(num, offset).Where("type=0").Asc("id").Find(&users)
return users, err
}