diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-15 14:46:26 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-15 15:29:07 +0100 |
commit | 2422c46b27790d94fd29a7092170cee5a1b56008 (patch) | |
tree | d5c1942ce20cadb27a551d87c789edfe92f5b105 /server/middlewares/validators/video-channels.ts | |
parent | 34cbef8c6cc912143a421413bdd832c4adcc556a (diff) | |
download | PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.gz PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.zst PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.zip |
Implement support field in video and video channel
Diffstat (limited to 'server/middlewares/validators/video-channels.ts')
-rw-r--r-- | server/middlewares/validators/video-channels.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts index 86bddde82..fe42105e8 100644 --- a/server/middlewares/validators/video-channels.ts +++ b/server/middlewares/validators/video-channels.ts | |||
@@ -5,7 +5,7 @@ import { isAccountIdExist } from '../../helpers/custom-validators/accounts' | |||
5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
6 | import { | 6 | import { |
7 | isVideoChannelDescriptionValid, isVideoChannelExist, | 7 | isVideoChannelDescriptionValid, isVideoChannelExist, |
8 | isVideoChannelNameValid | 8 | isVideoChannelNameValid, isVideoChannelSupportValid |
9 | } from '../../helpers/custom-validators/video-channels' | 9 | } from '../../helpers/custom-validators/video-channels' |
10 | import { logger } from '../../helpers/logger' | 10 | import { logger } from '../../helpers/logger' |
11 | import { UserModel } from '../../models/account/user' | 11 | import { UserModel } from '../../models/account/user' |
@@ -27,7 +27,8 @@ const listVideoAccountChannelsValidator = [ | |||
27 | 27 | ||
28 | const videoChannelsAddValidator = [ | 28 | const videoChannelsAddValidator = [ |
29 | body('name').custom(isVideoChannelNameValid).withMessage('Should have a valid name'), | 29 | body('name').custom(isVideoChannelNameValid).withMessage('Should have a valid name'), |
30 | body('description').custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), | 30 | body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), |
31 | body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), | ||
31 | 32 | ||
32 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 33 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
33 | logger.debug('Checking videoChannelsAdd parameters', { parameters: req.body }) | 34 | logger.debug('Checking videoChannelsAdd parameters', { parameters: req.body }) |
@@ -42,6 +43,7 @@ const videoChannelsUpdateValidator = [ | |||
42 | param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), | 43 | param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), |
43 | body('name').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid name'), | 44 | body('name').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid name'), |
44 | body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), | 45 | body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), |
46 | body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), | ||
45 | 47 | ||
46 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 48 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
47 | logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body }) | 49 | logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body }) |