aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/video-channels.ts
diff options
context:
space:
mode:
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// ---------------------------------------------------------------------------