aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/misc.ts7
-rw-r--r--server/helpers/custom-validators/pods.ts7
-rw-r--r--server/helpers/custom-validators/remote/videos.ts8
-rw-r--r--server/helpers/custom-validators/users.ts10
-rw-r--r--server/helpers/custom-validators/videos.ts36
5 files changed, 3 insertions, 65 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index 8d215a416..60fcdd5bb 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -14,10 +14,3 @@ export {
14 exists, 14 exists,
15 isArray 15 isArray
16} 16}
17
18declare module 'express-validator' {
19 export interface Validator {
20 exists,
21 isArray
22 }
23}
diff --git a/server/helpers/custom-validators/pods.ts b/server/helpers/custom-validators/pods.ts
index 844bfdf78..d5021bf38 100644
--- a/server/helpers/custom-validators/pods.ts
+++ b/server/helpers/custom-validators/pods.ts
@@ -32,10 +32,3 @@ export {
32 isEachUniqueHostValid, 32 isEachUniqueHostValid,
33 isHostValid 33 isHostValid
34} 34}
35
36declare module 'express-validator' {
37 export interface Validator {
38 isEachUniqueHostValid
39 isHostValid
40 }
41}
diff --git a/server/helpers/custom-validators/remote/videos.ts b/server/helpers/custom-validators/remote/videos.ts
index e5c76f3ca..e261e05a8 100644
--- a/server/helpers/custom-validators/remote/videos.ts
+++ b/server/helpers/custom-validators/remote/videos.ts
@@ -102,14 +102,6 @@ export {
102 isEachRemoteRequestVideosEventsValid 102 isEachRemoteRequestVideosEventsValid
103} 103}
104 104
105declare module 'express-validator' {
106 export interface Validator {
107 isEachRemoteRequestVideosValid,
108 isEachRemoteRequestVideosQaduValid,
109 isEachRemoteRequestVideosEventsValid
110 }
111}
112
113// --------------------------------------------------------------------------- 105// ---------------------------------------------------------------------------
114 106
115function isCommonVideoAttributesValid (video: any) { 107function isCommonVideoAttributesValid (video: any) {
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 805437efa..c180eccda 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -39,13 +39,3 @@ export {
39 isUserUsernameValid, 39 isUserUsernameValid,
40 isUserDisplayNSFWValid 40 isUserDisplayNSFWValid
41} 41}
42
43declare module 'express-validator' {
44 export interface Validator {
45 isUserPasswordValid,
46 isUserRoleValid,
47 isUserUsernameValid,
48 isUserDisplayNSFWValid,
49 isUserVideoQuotaValid
50 }
51}
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index 1d27e47fc..2eb021ae7 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -107,12 +107,13 @@ function isVideoRatingTypeValid (value: string) {
107 return values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1 107 return values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1
108} 108}
109 109
110function isVideoFile (value: string, files: { [ fieldname: string ]: Express.Multer.File[] }) { 110function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) {
111 // Should have files 111 // Should have files
112 if (!files) return false 112 if (!files) return false
113 if (isArray(files)) return false
113 114
114 // Should have videofile file 115 // Should have videofile file
115 const videofile = files.videofile 116 const videofile = files['videofile']
116 if (!videofile || videofile.length === 0) return false 117 if (!videofile || videofile.length === 0) return false
117 118
118 // The file should exist 119 // The file should exist
@@ -168,34 +169,3 @@ export {
168 isVideoFileSizeValid, 169 isVideoFileSizeValid,
169 isVideoFileResolutionValid 170 isVideoFileResolutionValid
170} 171}
171
172declare module 'express-validator' {
173 export interface Validator {
174 isVideoIdOrUUIDValid,
175 isVideoAuthorValid,
176 isVideoDateValid,
177 isVideoCategoryValid,
178 isVideoLicenceValid,
179 isVideoLanguageValid,
180 isVideoNSFWValid,
181 isVideoDescriptionValid,
182 isVideoDurationValid,
183 isVideoInfoHashValid,
184 isVideoNameValid,
185 isVideoTagsValid,
186 isVideoThumbnailValid,
187 isVideoThumbnailDataValid,
188 isVideoExtnameValid,
189 isVideoUUIDValid,
190 isVideoAbuseReasonValid,
191 isVideoAbuseReporterUsernameValid,
192 isVideoFile,
193 isVideoViewsValid,
194 isVideoLikesValid,
195 isVideoRatingTypeValid,
196 isVideoDislikesValid,
197 isVideoEventCountValid,
198 isVideoFileSizeValid,
199 isVideoFileResolutionValid
200 }
201}