-import { areValidationErrors } from '../utils'
-import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor'
-import { ActorModel } from '../../../models/activitypub/actor'
-
-const listVideoAccountChannelsValidator = [
- param('accountName').exists().withMessage('Should have a valid account name'),
-
- async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body })
-
- if (areValidationErrors(req, res)) return
- if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
-
- return next()
- }
-]
-
-const videoChannelsAddValidator = [
- body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'),
- body('displayName').custom(isVideoChannelNameValid).withMessage('Should have a valid display name'),
- body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'),
- body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'),
+import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared'
+import { doesVideoChannelSyncIdExist } from '../shared/video-channel-syncs'
+
+export const videoChannelsAddValidator = [
+ body('name')
+ .custom(isVideoChannelUsernameValid),
+ body('displayName')
+ .custom(isVideoChannelDisplayNameValid),
+ body('description')
+ .optional()
+ .custom(isVideoChannelDescriptionValid),
+ body('support')
+ .optional()
+ .custom(isVideoChannelSupportValid),