]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/custom-validators/video-channels.ts
Add hooks documentation
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / video-channels.ts
CommitLineData
72c7248b
C
1import 'express-validator'
2import 'multer'
4e50b6a1 3import * as validator from 'validator'
74dc3bca 4import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
4e50b6a1 5import { exists } from './misc'
72c7248b
C
6
7const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS
8
9function isVideoChannelDescriptionValid (value: string) {
10 return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)
11}
12
13function isVideoChannelNameValid (value: string) {
14 return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)
15}
16
2422c46b
C
17function isVideoChannelSupportValid (value: string) {
18 return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))
19}
20
72c7248b
C
21// ---------------------------------------------------------------------------
22
23export {
24 isVideoChannelDescriptionValid,
4e50b6a1 25 isVideoChannelNameValid,
5b77537c 26 isVideoChannelSupportValid
06a05d5f 27}