From 0b69752270f1ceea06a29872b3db23660a55d6d3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Dec 2015 16:13:32 +0100 Subject: Add a pool of requests instead of making a request at each action (add video/remove video) for performance in big networks --- middlewares/reqValidators/remote.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'middlewares') diff --git a/middlewares/reqValidators/remote.js b/middlewares/reqValidators/remote.js index e851b49a4..642dad1c7 100644 --- a/middlewares/reqValidators/remote.js +++ b/middlewares/reqValidators/remote.js @@ -18,10 +18,8 @@ } remote.remoteVideosAdd = function (req, res, next) { - req.checkBody('data.name', 'Should have a name').isLength(1, 50) - req.checkBody('data.description', 'Should have a description').isLength(1, 250) - req.checkBody('data.magnetUri', 'Should have a magnetUri').notEmpty() - req.checkBody('data.podUrl', 'Should have a podUrl').isURL() + req.checkBody('data').isArray() + req.checkBody('data').eachIsRemoteVideosAddValid() logger.debug('Checking remoteVideosAdd parameters', { parameters: req.body }) @@ -29,7 +27,8 @@ } remote.remoteVideosRemove = function (req, res, next) { - req.checkBody('data.magnetUri', 'Should have a magnetUri').notEmpty() + req.checkBody('data').isArray() + req.checkBody('data').eachIsRemoteVideosRemoveValid() logger.debug('Checking remoteVideosRemove parameters', { parameters: req.body }) -- cgit v1.2.3