aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-change-ownership.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-change-ownership.ts')
-rw-r--r--server/models/video/video-change-ownership.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/models/video/video-change-ownership.ts b/server/models/video/video-change-ownership.ts
index c9cff5054..48c07728f 100644
--- a/server/models/video/video-change-ownership.ts
+++ b/server/models/video/video-change-ownership.ts
@@ -39,7 +39,9 @@ enum ScopeNames {
39 { 39 {
40 model: () => VideoModel, 40 model: () => VideoModel,
41 required: true, 41 required: true,
42 include: [{ model: () => VideoFileModel }] 42 include: [
43 { model: () => VideoFileModel }
44 ]
43 } 45 }
44 ] 46 ]
45 } 47 }
@@ -94,15 +96,17 @@ export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel>
94 Video: VideoModel 96 Video: VideoModel
95 97
96 static listForApi (nextOwnerId: number, start: number, count: number, sort: string) { 98 static listForApi (nextOwnerId: number, start: number, count: number, sort: string) {
97 return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findAndCountAll({ 99 const query = {
98 offset: start, 100 offset: start,
99 limit: count, 101 limit: count,
100 order: getSort(sort), 102 order: getSort(sort),
101 where: { 103 where: {
102 nextOwnerAccountId: nextOwnerId 104 nextOwnerAccountId: nextOwnerId
103 } 105 }
104 }) 106 }
105 .then(({ rows, count }) => ({ total: count, data: rows })) 107
108 return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findAndCountAll(query)
109 .then(({ rows, count }) => ({ total: count, data: rows }))
106 } 110 }
107 111
108 static load (id: number) { 112 static load (id: number) {