]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/custom-validators/video-blacklist.ts
Add search target check params
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / video-blacklist.ts
CommitLineData
7cde3b9c 1import validator from 'validator'
7ccddd7b 2import { exists } from './misc'
74dc3bca 3import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
7ccddd7b 4import { VideoBlacklistType } from '../../../shared/models/videos'
26b7305a
C
5
6const VIDEO_BLACKLIST_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_BLACKLIST
7
8function isVideoBlacklistReasonValid (value: string) {
9 return value === null || validator.isLength(value, VIDEO_BLACKLIST_CONSTRAINTS_FIELDS.REASON)
10}
11
7ccddd7b
JM
12function isVideoBlacklistTypeValid (value: any) {
13 return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined
14}
15
26b7305a
C
16// ---------------------------------------------------------------------------
17
18export {
19 isVideoBlacklistReasonValid,
3e753302 20 isVideoBlacklistTypeValid
26b7305a 21}