aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r--server/helpers/custom-validators/videos.ts20
1 files changed, 0 insertions, 20 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index 05d1dc607..4e441fe5f 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -23,18 +23,6 @@ const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
23const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES 23const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
24const VIDEO_EVENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_EVENTS 24const VIDEO_EVENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_EVENTS
25 25
26function isVideoIdOrUUIDValid (value: string) {
27 return validator.isInt(value) || isVideoUUIDValid(value)
28}
29
30function isVideoAuthorValid (value: string) {
31 return isUserUsernameValid(value)
32}
33
34function isVideoDateValid (value: string) {
35 return exists(value) && validator.isISO8601(value)
36}
37
38function isVideoCategoryValid (value: number) { 26function isVideoCategoryValid (value: number) {
39 return VIDEO_CATEGORIES[value] !== undefined 27 return VIDEO_CATEGORIES[value] !== undefined
40} 28}
@@ -79,10 +67,6 @@ function isVideoThumbnailDataValid (value: string) {
79 return exists(value) && validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL_DATA) 67 return exists(value) && validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL_DATA)
80} 68}
81 69
82function isVideoUUIDValid (value: string) {
83 return exists(value) && validator.isUUID('' + value, 4)
84}
85
86function isVideoAbuseReasonValid (value: string) { 70function isVideoAbuseReasonValid (value: string) {
87 return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.REASON) 71 return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.REASON)
88} 72}
@@ -170,9 +154,6 @@ function checkVideoExists (id: string, res: express.Response, callback: () => vo
170// --------------------------------------------------------------------------- 154// ---------------------------------------------------------------------------
171 155
172export { 156export {
173 isVideoIdOrUUIDValid,
174 isVideoAuthorValid,
175 isVideoDateValid,
176 isVideoCategoryValid, 157 isVideoCategoryValid,
177 isVideoLicenceValid, 158 isVideoLicenceValid,
178 isVideoLanguageValid, 159 isVideoLanguageValid,
@@ -185,7 +166,6 @@ export {
185 isVideoThumbnailValid, 166 isVideoThumbnailValid,
186 isVideoThumbnailDataValid, 167 isVideoThumbnailDataValid,
187 isVideoFileExtnameValid, 168 isVideoFileExtnameValid,
188 isVideoUUIDValid,
189 isVideoAbuseReasonValid, 169 isVideoAbuseReasonValid,
190 isVideoAbuseReporterUsernameValid, 170 isVideoAbuseReporterUsernameValid,
191 isVideoFile, 171 isVideoFile,