aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-16 15:25:20 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commit06a05d5f4784a7cbb27aa1188385b5679845dad8 (patch)
treeac197f3ed0768529456225ad76c912f22bc55e29 /server/middlewares/validators/video-channels.ts
parent4bda2e47bbc937c401ddcf14c1be53c70481a294 (diff)
downloadPeerTube-06a05d5f4784a7cbb27aa1188385b5679845dad8.tar.gz
PeerTube-06a05d5f4784a7cbb27aa1188385b5679845dad8.tar.zst
PeerTube-06a05d5f4784a7cbb27aa1188385b5679845dad8.zip
Add subscriptions endpoints to REST API
Diffstat (limited to 'server/middlewares/validators/video-channels.ts')
-rw-r--r--server/middlewares/validators/video-channels.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts
index 143ce9582..d354c7e05 100644
--- a/server/middlewares/validators/video-channels.ts
+++ b/server/middlewares/validators/video-channels.ts
@@ -4,6 +4,7 @@ import { UserRight } from '../../../shared'
4import { isAccountNameWithHostExist } from '../../helpers/custom-validators/accounts' 4import { isAccountNameWithHostExist } from '../../helpers/custom-validators/accounts'
5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
6import { 6import {
7 isLocalVideoChannelNameExist,
7 isVideoChannelDescriptionValid, 8 isVideoChannelDescriptionValid,
8 isVideoChannelExist, 9 isVideoChannelExist,
9 isVideoChannelNameValid, 10 isVideoChannelNameValid,
@@ -100,6 +101,19 @@ const videoChannelsGetValidator = [
100 } 101 }
101] 102]
102 103
104const localVideoChannelValidator = [
105 param('name').custom(isVideoChannelNameValid).withMessage('Should have a valid video channel name'),
106
107 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
108 logger.debug('Checking localVideoChannelValidator parameters', { parameters: req.params })
109
110 if (areValidationErrors(req, res)) return
111 if (!await isLocalVideoChannelNameExist(req.params.name, res)) return
112
113 return next()
114 }
115]
116
103// --------------------------------------------------------------------------- 117// ---------------------------------------------------------------------------
104 118
105export { 119export {
@@ -107,7 +121,8 @@ export {
107 videoChannelsAddValidator, 121 videoChannelsAddValidator,
108 videoChannelsUpdateValidator, 122 videoChannelsUpdateValidator,
109 videoChannelsRemoveValidator, 123 videoChannelsRemoveValidator,
110 videoChannelsGetValidator 124 videoChannelsGetValidator,
125 localVideoChannelValidator
111} 126}
112 127
113// --------------------------------------------------------------------------- 128// ---------------------------------------------------------------------------