aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-20 14:35:18 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commitd525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9 (patch)
tree4305044c4a97bdf1275b241c63cb0e85151cfb6a /server/controllers/api/videos/index.ts
parent57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (diff)
downloadPeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.tar.gz
PeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.tar.zst
PeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.zip
Add videos list filters
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 547522123..101183eab 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -31,6 +31,7 @@ import {
31 asyncMiddleware, 31 asyncMiddleware,
32 asyncRetryTransactionMiddleware, 32 asyncRetryTransactionMiddleware,
33 authenticate, 33 authenticate,
34 commonVideosFiltersValidator,
34 optionalAuthenticate, 35 optionalAuthenticate,
35 paginationValidator, 36 paginationValidator,
36 setDefaultPagination, 37 setDefaultPagination,
@@ -49,7 +50,7 @@ import { blacklistRouter } from './blacklist'
49import { videoCommentRouter } from './comment' 50import { videoCommentRouter } from './comment'
50import { rateVideoRouter } from './rate' 51import { rateVideoRouter } from './rate'
51import { VideoFilter } from '../../../../shared/models/videos/video-query.type' 52import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
52import { createReqFiles, isNSFWHidden } from '../../../helpers/express-utils' 53import { createReqFiles, buildNSFWFilter } from '../../../helpers/express-utils'
53import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' 54import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
54import { videoCaptionsRouter } from './captions' 55import { videoCaptionsRouter } from './captions'
55 56
@@ -90,6 +91,7 @@ videosRouter.get('/',
90 setDefaultSort, 91 setDefaultSort,
91 setDefaultPagination, 92 setDefaultPagination,
92 optionalAuthenticate, 93 optionalAuthenticate,
94 commonVideosFiltersValidator,
93 asyncMiddleware(listVideos) 95 asyncMiddleware(listVideos)
94) 96)
95videosRouter.put('/:id', 97videosRouter.put('/:id',
@@ -401,8 +403,12 @@ async function listVideos (req: express.Request, res: express.Response, next: ex
401 start: req.query.start, 403 start: req.query.start,
402 count: req.query.count, 404 count: req.query.count,
403 sort: req.query.sort, 405 sort: req.query.sort,
404 category: req.query.category, 406 categoryOneOf: req.query.categoryOneOf,
405 hideNSFW: isNSFWHidden(res), 407 licenceOneOf: req.query.licenceOneOf,
408 languageOneOf: req.query.languageOneOf,
409 tagsOneOf: req.query.tagsOneOf,
410 tagsAllOf: req.query.tagsAllOf,
411 nsfw: buildNSFWFilter(res, req.query.nsfw),
406 filter: req.query.filter as VideoFilter, 412 filter: req.query.filter as VideoFilter,
407 withFiles: false 413 withFiles: false
408 }) 414 })