Get the count of the all system users at endpoint /users/stats (#8847)

* Get the count of the all system users at endpoint /users/stats

* Added GetTotalUsersStats test in api4

* Changed pluralization and added the test back.
Этот коммит содержится в:
lisakycho
2018-06-07 09:45:49 -07:00
коммит произвёл Joram Wilander
родитель c8d9595833
Коммит e09b3c566b
5 изменённых файлов: 80 добавлений и 20 удалений

Просмотреть файл

@@ -1392,6 +1392,17 @@ func (a *App) GetVerifyEmailToken(token string) (*model.Token, *model.AppError)
}
}
func (a *App) GetTotalUsersStats() (*model.UsersStats, *model.AppError) {
stats := &model.UsersStats{}
if result := <-a.Srv.Store.User().GetTotalUsersCount(); result.Err != nil {
return nil, result.Err
} else {
stats.TotalUsersCount = result.Data.(int64)
}
return stats, nil
}
func (a *App) VerifyUserEmail(userId string) *model.AppError {
return (<-a.Srv.Store.User().VerifyEmail(userId)).Err
}