From e09b3c566b2de1da1d916d3e209c96d43be739e2 Mon Sep 17 00:00:00 2001 From: lisakycho Date: Thu, 7 Jun 2018 09:45:49 -0700 Subject: 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. --- app/user.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/user.go') diff --git a/app/user.go b/app/user.go index 2325c6338..c6324eb5f 100644 --- a/app/user.go +++ b/app/user.go @@ -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 } -- cgit v1.2.3-1-g7c22