aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-channels.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/video-channels.ts')
-rw-r--r--server/helpers/custom-validators/video-channels.ts32
1 files changed, 0 insertions, 32 deletions
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts
deleted file mode 100644
index 249083f39..000000000
--- a/server/helpers/custom-validators/video-channels.ts
+++ /dev/null
@@ -1,32 +0,0 @@
1import validator from 'validator'
2import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
3import { exists } from './misc'
4import { isUserUsernameValid } from './users'
5
6const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS
7
8function isVideoChannelUsernameValid (value: string) {
9 // Use the same constraints than user username
10 return isUserUsernameValid(value)
11}
12
13function isVideoChannelDescriptionValid (value: string) {
14 return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)
15}
16
17function isVideoChannelDisplayNameValid (value: string) {
18 return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)
19}
20
21function isVideoChannelSupportValid (value: string) {
22 return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))
23}
24
25// ---------------------------------------------------------------------------
26
27export {
28 isVideoChannelUsernameValid,
29 isVideoChannelDescriptionValid,
30 isVideoChannelDisplayNameValid,
31 isVideoChannelSupportValid
32}