]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-share.ts
Add federation to ownership change
[github/Chocobozzz/PeerTube.git] / server / models / video / video-share.ts
index 602cc69b90f1d09b9480e7e1c935268aada22a2b..fa9a70d509b42fccb99a59e8a10b9139a91f8b15 100644 (file)
@@ -99,7 +99,7 @@ export class VideoShareModel extends Model<VideoShareModel> {
   }
 
   static loadByUrl (url: string, t: Sequelize.Transaction) {
-    return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({
+    return VideoShareModel.scope(ScopeNames.FULL).findOne({
       where: {
         url
       },
@@ -187,4 +187,17 @@ export class VideoShareModel extends Model<VideoShareModel> {
       .findAll(query)
       .then(res => res.map(r => r.Actor))
   }
+
+  static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) {
+    const query = {
+      offset: start,
+      limit: count,
+      where: {
+        videoId
+      },
+      transaction: t
+    }
+
+    return VideoShareModel.findAndCountAll(query)
+  }
 }