]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-change-ownership.ts
Correctly delete directories on import
[github/Chocobozzz/PeerTube.git] / server / models / video / video-change-ownership.ts
index c9cff50545144eac09d4a7402e12ebb132ab57f8..48c07728f66b9b87af81be3fdf5dbc2d555e04bf 100644 (file)
@@ -39,7 +39,9 @@ enum ScopeNames {
       {
         model: () => VideoModel,
         required: true,
-        include: [{ model: () => VideoFileModel }]
+        include: [
+          { model: () => VideoFileModel }
+        ]
       }
     ]
   }
@@ -94,15 +96,17 @@ export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel>
   Video: VideoModel
 
   static listForApi (nextOwnerId: number, start: number, count: number, sort: string) {
-    return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findAndCountAll({
+    const query = {
       offset: start,
       limit: count,
       order: getSort(sort),
       where: {
         nextOwnerAccountId: nextOwnerId
       }
-    })
-      .then(({ rows, count }) => ({ total: count, data: rows }))
+    }
+
+    return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findAndCountAll(query)
+                                    .then(({ rows, count }) => ({ total: count, data: rows }))
   }
 
   static load (id: number) {