diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-31 16:30:11 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-31 16:44:46 +0200 |
commit | 7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c (patch) | |
tree | d2d2c9806dd1bf551ad39102149f514bca4c52eb /server/middlewares/validators | |
parent | 9977c128387f38dddd697b2e9a405dcea52407b7 (diff) | |
download | PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.tar.gz PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.tar.zst PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.zip |
Server: Bulk update videos support field
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/videos/video-channels.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index 4b26f0bc4..f5a59cacb 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts | |||
@@ -14,6 +14,7 @@ import { VideoChannelModel } from '../../../models/video/video-channel' | |||
14 | import { areValidationErrors } from '../utils' | 14 | import { areValidationErrors } from '../utils' |
15 | import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor' | 15 | import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor' |
16 | import { ActorModel } from '../../../models/activitypub/actor' | 16 | import { ActorModel } from '../../../models/activitypub/actor' |
17 | import { isBooleanValid } from '../../../helpers/custom-validators/misc' | ||
17 | 18 | ||
18 | const videoChannelsAddValidator = [ | 19 | const videoChannelsAddValidator = [ |
19 | body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), | 20 | body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), |
@@ -40,9 +41,18 @@ const videoChannelsAddValidator = [ | |||
40 | 41 | ||
41 | const videoChannelsUpdateValidator = [ | 42 | const videoChannelsUpdateValidator = [ |
42 | param('nameWithHost').exists().withMessage('Should have an video channel name with host'), | 43 | param('nameWithHost').exists().withMessage('Should have an video channel name with host'), |
43 | body('displayName').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), | 44 | body('displayName') |
44 | body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), | 45 | .optional() |
45 | body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), | 46 | .custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), |
47 | body('description') | ||
48 | .optional() | ||
49 | .custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), | ||
50 | body('support') | ||
51 | .optional() | ||
52 | .custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), | ||
53 | body('bulkVideosSupportUpdate') | ||
54 | .optional() | ||
55 | .custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'), | ||
46 | 56 | ||
47 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 57 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
48 | logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body }) | 58 | logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body }) |