diff options
Diffstat (limited to 'server/models/account')
-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 | } |