aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-28 18:04:46 +0100
committerChocobozzz <me@florianbigard.com>2018-02-28 18:04:55 +0100
commit09cababd79f9d445aa027c93cdfe823745fa041a (patch)
treef781d6ba78b5c4ce7220dea55f13b21230f203d6 /server/models/account/user.ts
parent22b59e8099947605085cf65a440f07f37fce6b65 (diff)
downloadPeerTube-09cababd79f9d445aa027c93cdfe823745fa041a.tar.gz
PeerTube-09cababd79f9d445aa027c93cdfe823745fa041a.tar.zst
PeerTube-09cababd79f9d445aa027c93cdfe823745fa041a.zip
Add stats route
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r--server/models/account/user.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 74cf0f4a8..afa9d7be0 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -13,6 +13,7 @@ import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
13import { OAuthTokenModel } from '../oauth/oauth-token' 13import { OAuthTokenModel } from '../oauth/oauth-token'
14import { getSort, throwIfNotValid } from '../utils' 14import { getSort, throwIfNotValid } from '../utils'
15import { VideoChannelModel } from '../video/video-channel' 15import { VideoChannelModel } from '../video/video-channel'
16import { VideoCommentModel } from '../video/video-comment'
16import { AccountModel } from './account' 17import { AccountModel } from './account'
17 18
18@DefaultScope({ 19@DefaultScope({
@@ -226,6 +227,14 @@ export class UserModel extends Model<UserModel> {
226 }) 227 })
227 } 228 }
228 229
230 static async getStats () {
231 const totalUsers = await UserModel.count()
232
233 return {
234 totalUsers
235 }
236 }
237
229 hasRight (right: UserRight) { 238 hasRight (right: UserRight) {
230 return hasUserRight(this.role, right) 239 return hasUserRight(this.role, right)
231 } 240 }