From fc51fde048f2c3ce1dd3e85f5528335040bae894 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 1 Jul 2016 16:16:40 +0200 Subject: reqValidators --> validators --- server/controllers/api/v1/pods.js | 8 ++++---- server/controllers/api/v1/remote.js | 8 ++++---- server/controllers/api/v1/users.js | 1 + server/controllers/api/v1/videos.js | 24 ++++++++++++------------ 4 files changed, 21 insertions(+), 20 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index 9ce8120b2..4413fbc1e 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js @@ -8,16 +8,16 @@ const logger = require('../../../helpers/logger') const friends = require('../../../lib/friends') const middlewares = require('../../../middlewares') const oAuth = middlewares.oauth -const reqValidator = middlewares.reqValidators.pods -const signatureValidator = middlewares.reqValidators.remote.signature +const validators = middlewares.validators.pods +const signatureValidator = middlewares.validators.remote.signature const router = express.Router() const Pod = mongoose.model('Pod') const Video = mongoose.model('Video') router.get('/', listPodsUrl) -router.post('/', reqValidator.podsAdd, addPods) -router.get('/makefriends', oAuth.authenticate, reqValidator.makeFriends, makeFriends) +router.post('/', validators.podsAdd, addPods) +router.get('/makefriends', oAuth.authenticate, validators.makeFriends, makeFriends) router.get('/quitfriends', oAuth.authenticate, quitFriends) // Post because this is a secured request router.post('/remove', signatureValidator, removePods) diff --git a/server/controllers/api/v1/remote.js b/server/controllers/api/v1/remote.js index 2d71c605d..7af9b7e84 100644 --- a/server/controllers/api/v1/remote.js +++ b/server/controllers/api/v1/remote.js @@ -6,17 +6,17 @@ const mongoose = require('mongoose') const middlewares = require('../../../middlewares') const secureMiddleware = middlewares.secure -const reqValidator = middlewares.reqValidators.remote +const validators = middlewares.validators.remote const logger = require('../../../helpers/logger') const router = express.Router() const Video = mongoose.model('Video') router.post('/videos', - reqValidator.signature, - reqValidator.dataToDecrypt, + validators.signature, + validators.dataToDecrypt, secureMiddleware.decryptBody, - reqValidator.remoteVideos, + validators.remoteVideos, remoteVideos ) diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js index caa979567..dde459a73 100644 --- a/server/controllers/api/v1/users.js +++ b/server/controllers/api/v1/users.js @@ -3,6 +3,7 @@ const config = require('config') const mongoose = require('mongoose') const express = require('express') + const oAuth = require('../../../middlewares').oauth const Client = mongoose.model('OAuthClient') diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index ab115bc30..a37e9278e 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js @@ -11,10 +11,10 @@ const friends = require('../../../lib/friends') const middlewares = require('../../../middlewares') const oAuth = middlewares.oauth const pagination = middlewares.pagination -const reqValidator = middlewares.reqValidators -const reqValidatorPagination = reqValidator.pagination -const reqValidatorSort = reqValidator.sort -const reqValidatorVideos = reqValidator.videos +const validators = middlewares.validators +const validatorsPagination = validators.pagination +const validatorsSort = validators.sort +const validatorsVideos = validators.videos const search = middlewares.search const sort = middlewares.sort const utils = require('../../../helpers/utils') @@ -44,8 +44,8 @@ const storage = multer.diskStorage({ const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) router.get('/', - reqValidatorPagination.pagination, - reqValidatorSort.videosSort, + validatorsPagination.pagination, + validatorsSort.videosSort, sort.setVideosSort, pagination.setPagination, listVideos @@ -53,22 +53,22 @@ router.get('/', router.post('/', oAuth.authenticate, reqFiles, - reqValidatorVideos.videosAdd, + validatorsVideos.videosAdd, addVideo ) router.get('/:id', - reqValidatorVideos.videosGet, + validatorsVideos.videosGet, getVideo ) router.delete('/:id', oAuth.authenticate, - reqValidatorVideos.videosRemove, + validatorsVideos.videosRemove, removeVideo ) router.get('/search/:value', - reqValidatorVideos.videosSearch, - reqValidatorPagination.pagination, - reqValidatorSort.videosSort, + validatorsVideos.videosSearch, + validatorsPagination.pagination, + validatorsSort.videosSort, sort.setVideosSort, pagination.setPagination, search.setVideosSearch, -- cgit v1.2.3