diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video/video-comment.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 18398905e..353fb1a0e 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -340,6 +340,28 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
340 | return VideoCommentModel.findAndCountAll(query) | 340 | return VideoCommentModel.findAndCountAll(query) |
341 | } | 341 | } |
342 | 342 | ||
343 | static listForFeed (start: number, count: number, videoId?: number) { | ||
344 | const query = { | ||
345 | order: [ [ 'createdAt', 'DESC' ] ], | ||
346 | start, | ||
347 | count, | ||
348 | where: {}, | ||
349 | include: [ | ||
350 | { | ||
351 | attributes: [ 'name' ], | ||
352 | model: VideoModel.unscoped(), | ||
353 | required: true | ||
354 | } | ||
355 | ] | ||
356 | } | ||
357 | |||
358 | if (videoId) query.where['videoId'] = videoId | ||
359 | |||
360 | return VideoCommentModel | ||
361 | .scope([ ScopeNames.WITH_ACCOUNT ]) | ||
362 | .findAll(query) | ||
363 | } | ||
364 | |||
343 | static async getStats () { | 365 | static async getStats () { |
344 | const totalLocalVideoComments = await VideoCommentModel.count({ | 366 | const totalLocalVideoComments = await VideoCommentModel.count({ |
345 | include: [ | 367 | include: [ |