1 import validator from 'validator'
2 import { exists } from './misc'
3 import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
4 import { VideoBlacklistType } from '../../../shared/models/videos'
6 const VIDEO_BLACKLIST_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_BLACKLIST
8 function isVideoBlacklistReasonValid (value: string) {
9 return value === null || validator.isLength(value, VIDEO_BLACKLIST_CONSTRAINTS_FIELDS.REASON)
12 function isVideoBlacklistTypeValid (value: any) {
13 return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined
16 // ---------------------------------------------------------------------------
19 isVideoBlacklistReasonValid,
20 isVideoBlacklistTypeValid