diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:15:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:15:16 +0100 |
commit | fe98765624cdd6695739bda719fcb726b71c2b2a (patch) | |
tree | 18b19d427e5c25fc9e5290062f307e668f4c9e45 /server/controllers/api/videos/index.ts | |
parent | ddc07312b041c1c533b68a919681fc9bce83430d (diff) | |
download | PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.gz PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.zst PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.zip |
Add ability to skip count query
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 35f0b3152..8d4ff07eb 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -48,7 +48,7 @@ import { videoCommentRouter } from './comment' | |||
48 | import { rateVideoRouter } from './rate' | 48 | import { rateVideoRouter } from './rate' |
49 | import { ownershipVideoRouter } from './ownership' | 49 | import { ownershipVideoRouter } from './ownership' |
50 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | 50 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' |
51 | import { buildNSFWFilter, createReqFiles } from '../../../helpers/express-utils' | 51 | import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils' |
52 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | 52 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' |
53 | import { videoCaptionsRouter } from './captions' | 53 | import { videoCaptionsRouter } from './captions' |
54 | import { videoImportsRouter } from './import' | 54 | import { videoImportsRouter } from './import' |
@@ -495,6 +495,8 @@ async function getVideoDescription (req: express.Request, res: express.Response) | |||
495 | } | 495 | } |
496 | 496 | ||
497 | async function listVideos (req: express.Request, res: express.Response) { | 497 | async function listVideos (req: express.Request, res: express.Response) { |
498 | const countVideos = getCountVideos(req) | ||
499 | |||
498 | const apiOptions = await Hooks.wrapObject({ | 500 | const apiOptions = await Hooks.wrapObject({ |
499 | start: req.query.start, | 501 | start: req.query.start, |
500 | count: req.query.count, | 502 | count: req.query.count, |
@@ -508,7 +510,8 @@ async function listVideos (req: express.Request, res: express.Response) { | |||
508 | nsfw: buildNSFWFilter(res, req.query.nsfw), | 510 | nsfw: buildNSFWFilter(res, req.query.nsfw), |
509 | filter: req.query.filter as VideoFilter, | 511 | filter: req.query.filter as VideoFilter, |
510 | withFiles: false, | 512 | withFiles: false, |
511 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined | 513 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, |
514 | countVideos | ||
512 | }, 'filter:api.videos.list.params') | 515 | }, 'filter:api.videos.list.params') |
513 | 516 | ||
514 | const resultList = await Hooks.wrapPromiseFun( | 517 | const resultList = await Hooks.wrapPromiseFun( |