diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-28 18:04:46 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-28 18:04:55 +0100 |
commit | 09cababd79f9d445aa027c93cdfe823745fa041a (patch) | |
tree | f781d6ba78b5c4ce7220dea55f13b21230f203d6 /server/models/account/user.ts | |
parent | 22b59e8099947605085cf65a440f07f37fce6b65 (diff) | |
download | PeerTube-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.ts | 9 |
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' | |||
13 | import { OAuthTokenModel } from '../oauth/oauth-token' | 13 | import { OAuthTokenModel } from '../oauth/oauth-token' |
14 | import { getSort, throwIfNotValid } from '../utils' | 14 | import { getSort, throwIfNotValid } from '../utils' |
15 | import { VideoChannelModel } from '../video/video-channel' | 15 | import { VideoChannelModel } from '../video/video-channel' |
16 | import { VideoCommentModel } from '../video/video-comment' | ||
16 | import { AccountModel } from './account' | 17 | import { 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 | } |