aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/videos.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index c3604fbad..1d56ade6f 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -2,6 +2,7 @@ import { UploadFilesForCheck } from 'express'
2import { values } from 'lodash' 2import { values } from 'lodash'
3import magnetUtil from 'magnet-uri' 3import magnetUtil from 'magnet-uri'
4import validator from 'validator' 4import validator from 'validator'
5import { VideoInclude } from '@shared/models'
5import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' 6import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared'
6import { 7import {
7 CONSTRAINTS_FIELDS, 8 CONSTRAINTS_FIELDS,
@@ -21,6 +22,10 @@ function isVideoFilterValid (filter: VideoFilter) {
21 return filter === 'local' || filter === 'all-local' || filter === 'all' 22 return filter === 'local' || filter === 'all-local' || filter === 'all'
22} 23}
23 24
25function isVideoIncludeValid (include: VideoInclude) {
26 return exists(include) && validator.isInt('' + include)
27}
28
24function isVideoCategoryValid (value: any) { 29function isVideoCategoryValid (value: any) {
25 return value === null || VIDEO_CATEGORIES[value] !== undefined 30 return value === null || VIDEO_CATEGORIES[value] !== undefined
26} 31}
@@ -146,6 +151,7 @@ export {
146 isVideoOriginallyPublishedAtValid, 151 isVideoOriginallyPublishedAtValid,
147 isVideoMagnetUriValid, 152 isVideoMagnetUriValid,
148 isVideoStateValid, 153 isVideoStateValid,
154 isVideoIncludeValid,
149 isVideoViewsValid, 155 isVideoViewsValid,
150 isVideoRatingTypeValid, 156 isVideoRatingTypeValid,
151 isVideoFileExtnameValid, 157 isVideoFileExtnameValid,