diff options
author | lisakycho <lisakycho@gmail.com> | 2018-06-07 09:45:49 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-06-07 12:45:49 -0400 |
commit | e09b3c566b2de1da1d916d3e209c96d43be739e2 (patch) | |
tree | 3a9629a4fdac0a6e43382a17484458cc60ce2a25 /app/user.go | |
parent | c8d95958335c8daf8e67aa021c2c82f78bf4abd4 (diff) | |
download | chat-e09b3c566b2de1da1d916d3e209c96d43be739e2.tar.gz chat-e09b3c566b2de1da1d916d3e209c96d43be739e2.tar.bz2 chat-e09b3c566b2de1da1d916d3e209c96d43be739e2.zip |
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.
Diffstat (limited to 'app/user.go')
-rw-r--r-- | app/user.go | 11 |
1 files changed, 11 insertions, 0 deletions
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 } |