X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-comment.ts;h=f84c1880c6a564fc11c61959514450e25e121e3c;hb=d9eaee3939bf2e93e5d775d32bce77842201faba;hp=353fb1a0eb947cbee47b8ef28d9b88242c10f5d4;hpb=fe3a55b071c99b346e9e9ab786f5d219e5a064cd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 353fb1a0e..f84c1880c 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -108,6 +108,9 @@ enum ScopeNames { { fields: [ 'url' ], unique: true + }, + { + fields: [ 'accountId' ] } ] }) @@ -153,7 +156,7 @@ export class VideoCommentModel extends Model { as: 'InReplyToVideoComment', onDelete: 'CASCADE' }) - InReplyToVideoComment: VideoCommentModel + InReplyToVideoComment: VideoCommentModel | null @ForeignKey(() => VideoModel) @Column @@ -329,8 +332,8 @@ export class VideoCommentModel extends Model { static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') { const query = { order: [ [ 'createdAt', order ] ], - start, - count, + offset: start, + limit: count, where: { videoId }, @@ -343,12 +346,12 @@ export class VideoCommentModel extends Model { static listForFeed (start: number, count: number, videoId?: number) { const query = { order: [ [ 'createdAt', 'DESC' ] ], - start, - count, + offset: start, + limit: count, where: {}, include: [ { - attributes: [ 'name' ], + attributes: [ 'name', 'uuid' ], model: VideoModel.unscoped(), required: true }