diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/videos/video-channels.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index ebce14714..882fb2b84 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
3 | import { UserRight } from '../../../../shared' | 3 | import { UserRight } from '../../../../shared' |
4 | import { | 4 | import { |
5 | isVideoChannelDescriptionValid, | 5 | isVideoChannelDescriptionValid, |
@@ -128,6 +128,15 @@ const localVideoChannelValidator = [ | |||
128 | } | 128 | } |
129 | ] | 129 | ] |
130 | 130 | ||
131 | const videoChannelStatsValidator = [ | ||
132 | query('withStats').optional().isBoolean().withMessage('Should have a valid stats flag'), | ||
133 | |||
134 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
135 | if (areValidationErrors(req, res)) return | ||
136 | return next() | ||
137 | } | ||
138 | ] | ||
139 | |||
131 | // --------------------------------------------------------------------------- | 140 | // --------------------------------------------------------------------------- |
132 | 141 | ||
133 | export { | 142 | export { |
@@ -135,7 +144,8 @@ export { | |||
135 | videoChannelsUpdateValidator, | 144 | videoChannelsUpdateValidator, |
136 | videoChannelsRemoveValidator, | 145 | videoChannelsRemoveValidator, |
137 | videoChannelsNameWithHostValidator, | 146 | videoChannelsNameWithHostValidator, |
138 | localVideoChannelValidator | 147 | localVideoChannelValidator, |
148 | videoChannelStatsValidator | ||
139 | } | 149 | } |
140 | 150 | ||
141 | // --------------------------------------------------------------------------- | 151 | // --------------------------------------------------------------------------- |