diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-25 16:21:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-25 16:21:16 +0200 |
commit | 8fffe21a7bc96d08b229293d66ddba576e609790 (patch) | |
tree | 5ebd5f5198a59084c5338ce197d7e836b39200a4 /server/models/video/video-share.ts | |
parent | e251f170b00b2014ac4e823113c6ff40e3fb1471 (diff) | |
download | PeerTube-8fffe21a7bc96d08b229293d66ddba576e609790.tar.gz PeerTube-8fffe21a7bc96d08b229293d66ddba576e609790.tar.zst PeerTube-8fffe21a7bc96d08b229293d66ddba576e609790.zip |
Refractor and optimize AP collections
Only display urls in general object, and paginate video comments, shares, likes and
dislikes
Diffstat (limited to 'server/models/video/video-share.ts')
-rw-r--r-- | server/models/video/video-share.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts index 602cc69b9..adadf5dea 100644 --- a/server/models/video/video-share.ts +++ b/server/models/video/video-share.ts | |||
@@ -187,4 +187,17 @@ export class VideoShareModel extends Model<VideoShareModel> { | |||
187 | .findAll(query) | 187 | .findAll(query) |
188 | .then(res => res.map(r => r.Actor)) | 188 | .then(res => res.map(r => r.Actor)) |
189 | } | 189 | } |
190 | |||
191 | static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) { | ||
192 | const query = { | ||
193 | start, | ||
194 | count, | ||
195 | where: { | ||
196 | videoId | ||
197 | }, | ||
198 | transaction: t | ||
199 | } | ||
200 | |||
201 | return VideoShareModel.findAndCountAll(query) | ||
202 | } | ||
190 | } | 203 | } |