aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-playlists.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/video-playlists.ts')
-rw-r--r--server/helpers/custom-validators/video-playlists.ts35
1 files changed, 0 insertions, 35 deletions
diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.ts
deleted file mode 100644
index 180018fc5..000000000
--- a/server/helpers/custom-validators/video-playlists.ts
+++ /dev/null
@@ -1,35 +0,0 @@
1import { exists } from './misc'
2import validator from 'validator'
3import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants'
4
5const PLAYLISTS_CONSTRAINT_FIELDS = CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS
6
7function isVideoPlaylistNameValid (value: any) {
8 return exists(value) && validator.isLength(value, PLAYLISTS_CONSTRAINT_FIELDS.NAME)
9}
10
11function isVideoPlaylistDescriptionValid (value: any) {
12 return value === null || (exists(value) && validator.isLength(value, PLAYLISTS_CONSTRAINT_FIELDS.DESCRIPTION))
13}
14
15function isVideoPlaylistPrivacyValid (value: number) {
16 return validator.isInt(value + '') && VIDEO_PLAYLIST_PRIVACIES[value] !== undefined
17}
18
19function isVideoPlaylistTimestampValid (value: any) {
20 return value === null || (exists(value) && validator.isInt('' + value, { min: 0 }))
21}
22
23function isVideoPlaylistTypeValid (value: any) {
24 return exists(value) && VIDEO_PLAYLIST_TYPES[value] !== undefined
25}
26
27// ---------------------------------------------------------------------------
28
29export {
30 isVideoPlaylistNameValid,
31 isVideoPlaylistDescriptionValid,
32 isVideoPlaylistPrivacyValid,
33 isVideoPlaylistTimestampValid,
34 isVideoPlaylistTypeValid
35}