diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-29 15:09:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-29 15:09:38 +0200 |
commit | 91b6631984fa7097bd60aa013d1cf041d7b95f58 (patch) | |
tree | 717cc94c3cba7b02ba404f2536ebc76118adf504 /server/models/video | |
parent | b247a132709eb212fef4f77c4912dc0ec108f36b (diff) | |
download | PeerTube-91b6631984fa7097bd60aa013d1cf041d7b95f58.tar.gz PeerTube-91b6631984fa7097bd60aa013d1cf041d7b95f58.tar.zst PeerTube-91b6631984fa7097bd60aa013d1cf041d7b95f58.zip |
Add pagination to account video channels endpoint
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-channel.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index fb70e6625..d73be18d6 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -334,14 +334,21 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
334 | }) | 334 | }) |
335 | } | 335 | } |
336 | 336 | ||
337 | static listByAccount (accountId: number) { | 337 | static listByAccount (options: { |
338 | accountId: number, | ||
339 | start: number, | ||
340 | count: number, | ||
341 | sort: string | ||
342 | }) { | ||
338 | const query = { | 343 | const query = { |
339 | order: getSort('createdAt'), | 344 | offset: options.start, |
345 | limit: options.count, | ||
346 | order: getSort(options.sort), | ||
340 | include: [ | 347 | include: [ |
341 | { | 348 | { |
342 | model: AccountModel, | 349 | model: AccountModel, |
343 | where: { | 350 | where: { |
344 | id: accountId | 351 | id: options.accountId |
345 | }, | 352 | }, |
346 | required: true | 353 | required: true |
347 | } | 354 | } |