1 import 'express-validator'
3 import * as validator from 'validator'
4 import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
5 import { exists } from './misc'
7 const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS
9 function isVideoChannelDescriptionValid (value: string) {
10 return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)
13 function isVideoChannelNameValid (value: string) {
14 return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)
17 function isVideoChannelSupportValid (value: string) {
18 return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))
21 // ---------------------------------------------------------------------------
24 isVideoChannelDescriptionValid,
25 isVideoChannelNameValid,
26 isVideoChannelSupportValid