X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Fcontrollers%2Fapi%2Fv1%2Fvideos.js;h=7f59dd232c88472548d371b58c726fb5f05d395d;hb=46246b5f194caafba4e3a72e9365acd8b35785de;hp=f7aeea4532e711aff477b6eca79f83134536789e;hpb=68ce3ae021c9bc11b155044df6d23ba60e91eee4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index f7aeea453..7f59dd232 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js @@ -17,6 +17,7 @@ const reqValidator = middlewares.reqValidators const reqValidatorPagination = reqValidator.pagination const reqValidatorSort = reqValidator.sort const reqValidatorVideos = reqValidator.videos +const search = middlewares.search const sort = middlewares.sort const utils = require('../../../helpers/utils') const Videos = require('../../../models/videos') // model @@ -69,12 +70,13 @@ router.delete('/:id', reqValidatorVideos.videosRemove, removeVideo ) -router.get('/search/:name', +router.get('/search/:value', reqValidatorVideos.videosSearch, reqValidatorPagination.pagination, reqValidatorSort.videosSort, sort.setVideosSort, pagination.setPagination, + search.setVideosSearch, searchVideos ) @@ -237,7 +239,8 @@ function removeVideo (req, res, next) { } function searchVideos (req, res, next) { - Videos.search(req.params.name, req.query.start, req.query.count, req.query.sort, function (err, videosList, totalVideos) { + Videos.search(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort, + function (err, videosList, totalVideos) { if (err) return next(err) res.json(getFormatedVideos(videosList, totalVideos))