diff options
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r-- | server/models/video/video-comment.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 5386a10aa..18398905e 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -326,6 +326,20 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
326 | .findAll(query) | 326 | .findAll(query) |
327 | } | 327 | } |
328 | 328 | ||
329 | static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') { | ||
330 | const query = { | ||
331 | order: [ [ 'createdAt', order ] ], | ||
332 | start, | ||
333 | count, | ||
334 | where: { | ||
335 | videoId | ||
336 | }, | ||
337 | transaction: t | ||
338 | } | ||
339 | |||
340 | return VideoCommentModel.findAndCountAll(query) | ||
341 | } | ||
342 | |||
329 | static async getStats () { | 343 | static async getStats () { |
330 | const totalLocalVideoComments = await VideoCommentModel.count({ | 344 | const totalLocalVideoComments = await VideoCommentModel.count({ |
331 | include: [ | 345 | include: [ |