aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/v1/videos.js7
1 files changed, 5 insertions, 2 deletions
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
17const reqValidatorPagination = reqValidator.pagination 17const reqValidatorPagination = reqValidator.pagination
18const reqValidatorSort = reqValidator.sort 18const reqValidatorSort = reqValidator.sort
19const reqValidatorVideos = reqValidator.videos 19const reqValidatorVideos = reqValidator.videos
20const search = middlewares.search
20const sort = middlewares.sort 21const sort = middlewares.sort
21const utils = require('../../../helpers/utils') 22const utils = require('../../../helpers/utils')
22const Videos = require('../../../models/videos') // model 23const Videos = require('../../../models/videos') // model
@@ -69,12 +70,13 @@ router.delete('/:id',
69 reqValidatorVideos.videosRemove, 70 reqValidatorVideos.videosRemove,
70 removeVideo 71 removeVideo
71) 72)
72router.get('/search/:name', 73router.get('/search/:value',
73 reqValidatorVideos.videosSearch, 74 reqValidatorVideos.videosSearch,
74 reqValidatorPagination.pagination, 75 reqValidatorPagination.pagination,
75 reqValidatorSort.videosSort, 76 reqValidatorSort.videosSort,
76 sort.setVideosSort, 77 sort.setVideosSort,
77 pagination.setPagination, 78 pagination.setPagination,
79 search.setVideosSearch,
78 searchVideos 80 searchVideos
79) 81)
80 82
@@ -237,7 +239,8 @@ function removeVideo (req, res, next) {
237} 239}
238 240
239function searchVideos (req, res, next) { 241function searchVideos (req, res, next) {
240 Videos.search(req.params.name, req.query.start, req.query.count, req.query.sort, function (err, videosList, totalVideos) { 242 Videos.search(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort,
243 function (err, videosList, totalVideos) {
241 if (err) return next(err) 244 if (err) return next(err)
242 245
243 res.json(getFormatedVideos(videosList, totalVideos)) 246 res.json(getFormatedVideos(videosList, totalVideos))