]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-comment.ts
add user account email verificiation (#977)
[github/Chocobozzz/PeerTube.git] / server / models / video / video-comment.ts
index 353fb1a0eb947cbee47b8ef28d9b88242c10f5d4..f84c1880c6a564fc11c61959514450e25e121e3c 100644 (file)
@@ -108,6 +108,9 @@ enum ScopeNames {
     {
       fields: [ 'url' ],
       unique: true
+    },
+    {
+      fields: [ 'accountId' ]
     }
   ]
 })
@@ -153,7 +156,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
     as: 'InReplyToVideoComment',
     onDelete: 'CASCADE'
   })
-  InReplyToVideoComment: VideoCommentModel
+  InReplyToVideoComment: VideoCommentModel | null
 
   @ForeignKey(() => VideoModel)
   @Column
@@ -329,8 +332,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
   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<VideoCommentModel> {
   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
         }