aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/videos/index.ts22
1 files changed, 9 insertions, 13 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index e2798830e..2b70d535e 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -26,7 +26,6 @@ import {
26 authenticate, 26 authenticate,
27 paginationValidator, 27 paginationValidator,
28 setPagination, 28 setPagination,
29 setVideosSearch,
30 setVideosSort, 29 setVideosSort,
31 videosAddValidator, 30 videosAddValidator,
32 videosGetValidator, 31 videosGetValidator,
@@ -84,6 +83,14 @@ videosRouter.get('/',
84 setPagination, 83 setPagination,
85 asyncMiddleware(listVideos) 84 asyncMiddleware(listVideos)
86) 85)
86videosRouter.get('/search',
87 videosSearchValidator,
88 paginationValidator,
89 videosSortValidator,
90 setVideosSort,
91 setPagination,
92 asyncMiddleware(searchVideos)
93)
87videosRouter.put('/:id', 94videosRouter.put('/:id',
88 authenticate, 95 authenticate,
89 asyncMiddleware(videosUpdateValidator), 96 asyncMiddleware(videosUpdateValidator),
@@ -115,16 +122,6 @@ videosRouter.delete('/:id',
115 asyncMiddleware(removeVideoRetryWrapper) 122 asyncMiddleware(removeVideoRetryWrapper)
116) 123)
117 124
118videosRouter.get('/search/:value',
119 videosSearchValidator,
120 paginationValidator,
121 videosSortValidator,
122 setVideosSort,
123 setPagination,
124 setVideosSearch,
125 asyncMiddleware(searchVideos)
126)
127
128// --------------------------------------------------------------------------- 125// ---------------------------------------------------------------------------
129 126
130export { 127export {
@@ -378,8 +375,7 @@ async function removeVideo (req: express.Request, res: express.Response) {
378 375
379async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 376async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
380 const resultList = await db.Video.searchAndPopulateAccountAndServerAndTags( 377 const resultList = await db.Video.searchAndPopulateAccountAndServerAndTags(
381 req.params.value, 378 req.query.search,
382 req.query.field,
383 req.query.start, 379 req.query.start,
384 req.query.count, 380 req.query.count,
385 req.query.sort 381 req.query.sort