aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-24 19:41:09 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-26 09:11:38 +0200
commit72c7248b6fdcdb2175e726ff51b42e7555f2bd84 (patch)
tree1bfdee99dbe2392cc997edba8e314e2a8a401c72 /server/helpers/custom-validators/videos.ts
parent8113a93a0d9f31aa9e23702bbc31b8a76275ae22 (diff)
downloadPeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.gz
PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.zst
PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.zip
Add video channels
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,