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/video/video-comment.ts | |
parent | 22b59e8099947605085cf65a440f07f37fce6b65 (diff) | |
download | PeerTube-09cababd79f9d445aa027c93cdfe823745fa041a.tar.gz PeerTube-09cababd79f9d445aa027c93cdfe823745fa041a.tar.zst PeerTube-09cababd79f9d445aa027c93cdfe823745fa041a.zip |
Add stats route
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r-- | server/models/video/video-comment.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 47e3211a3..bf8da924d 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -326,6 +326,32 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
326 | .findAll(query) | 326 | .findAll(query) |
327 | } | 327 | } |
328 | 328 | ||
329 | static async getStats () { | ||
330 | const totalLocalVideoComments = await VideoCommentModel.count({ | ||
331 | include: [ | ||
332 | { | ||
333 | model: AccountModel, | ||
334 | required: true, | ||
335 | include: [ | ||
336 | { | ||
337 | model: ActorModel, | ||
338 | required: true, | ||
339 | where: { | ||
340 | serverId: null | ||
341 | } | ||
342 | } | ||
343 | ] | ||
344 | } | ||
345 | ] | ||
346 | }) | ||
347 | const totalVideoComments = await VideoCommentModel.count() | ||
348 | |||
349 | return { | ||
350 | totalLocalVideoComments, | ||
351 | totalVideoComments | ||
352 | } | ||
353 | } | ||
354 | |||
329 | getThreadId (): number { | 355 | getThreadId (): number { |
330 | return this.originCommentId || this.id | 356 | return this.originCommentId || this.id |
331 | } | 357 | } |