From c06af5012ecc925ca924e6e20db3a1d909b1148e Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Thu, 26 Dec 2019 11:52:46 +0100 Subject: Add playlist search option and search input for add-to-video-playlist dropdown fixes #2138 --- server/middlewares/validators/videos/video-playlists.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'server/middlewares/validators/videos') diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 27ee62b1f..1d67e8666 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts @@ -166,6 +166,18 @@ const videoPlaylistsGetValidator = (fetchType: VideoPlaylistFetchType) => { ] } +const videoPlaylistsSearchValidator = [ + query('search').optional().not().isEmpty().withMessage('Should have a valid search'), + + (req: express.Request, res: express.Response, next: express.NextFunction) => { + logger.debug('Checking videoPlaylists search query', { parameters: req.query }) + + if (areValidationErrors(req, res)) return + + return next() + } +] + const videoPlaylistsAddVideoValidator = [ param('playlistId') .custom(isIdOrUUIDValid).withMessage('Should have a valid playlist id/uuid'), @@ -354,6 +366,7 @@ export { videoPlaylistsUpdateValidator, videoPlaylistsDeleteValidator, videoPlaylistsGetValidator, + videoPlaylistsSearchValidator, videoPlaylistsAddVideoValidator, videoPlaylistsUpdateOrRemoveVideoValidator, -- cgit v1.2.3