aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-03-24 01:12:30 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-03-31 10:29:24 +0200
commit747c562837e37f2fa455e8ef62165e9bb4e365f1 (patch)
treeae7628afb2865de93b195b064df1dace2e524dbe /server/middlewares
parent8165d00ac6263cf3c0d61d450960ef36635084ff (diff)
downloadPeerTube-747c562837e37f2fa455e8ef62165e9bb4e365f1.tar.gz
PeerTube-747c562837e37f2fa455e8ef62165e9bb4e365f1.tar.zst
PeerTube-747c562837e37f2fa455e8ef62165e9bb4e365f1.zip
Put channel stats behind withStats flag
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/videos/video-channels.ts14
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 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator' 2import { body, param, query } from 'express-validator'
3import { UserRight } from '../../../../shared' 3import { UserRight } from '../../../../shared'
4import { 4import {
5 isVideoChannelDescriptionValid, 5 isVideoChannelDescriptionValid,
@@ -128,6 +128,15 @@ const localVideoChannelValidator = [
128 } 128 }
129] 129]
130 130
131const 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
133export { 142export {
@@ -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// ---------------------------------------------------------------------------