aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-31 20:58:43 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-31 20:58:43 +0200
commite4c556196d7b31111f17596840d2e1d60caa7dcb (patch)
tree41be84f002600aa0153ac09cc5d79fdd90d126e3 /server/models
parente62f6ef741c8d14817e321c554796ad64ea7ae1b (diff)
downloadPeerTube-e4c556196d7b31111f17596840d2e1d60caa7dcb.tar.gz
PeerTube-e4c556196d7b31111f17596840d2e1d60caa7dcb.tar.zst
PeerTube-e4c556196d7b31111f17596840d2e1d60caa7dcb.zip
Server: reorganize express validators
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/models/video.js b/server/models/video.js
index 396aa505d..acb8353c2 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -9,7 +9,7 @@ const pathUtils = require('path')
9const mongoose = require('mongoose') 9const mongoose = require('mongoose')
10 10
11const constants = require('../initializers/constants') 11const constants = require('../initializers/constants')
12const customValidators = require('../helpers/custom-validators') 12const customVideosValidators = require('../helpers/custom-validators').videos
13const logger = require('../helpers/logger') 13const logger = require('../helpers/logger')
14const utils = require('../helpers/utils') 14const utils = require('../helpers/utils')
15const webtorrent = require('../lib/webtorrent') 15const webtorrent = require('../lib/webtorrent')
@@ -39,18 +39,18 @@ const VideoSchema = mongoose.Schema({
39 } 39 }
40}) 40})
41 41
42VideoSchema.path('name').validate(customValidators.isVideoNameValid) 42VideoSchema.path('name').validate(customVideosValidators.isVideoNameValid)
43VideoSchema.path('description').validate(customValidators.isVideoDescriptionValid) 43VideoSchema.path('description').validate(customVideosValidators.isVideoDescriptionValid)
44VideoSchema.path('magnetUri').validate(customValidators.isVideoMagnetUriValid) 44VideoSchema.path('magnetUri').validate(customVideosValidators.isVideoMagnetUriValid)
45VideoSchema.path('podUrl').validate(customValidators.isVideoPodUrlValid) 45VideoSchema.path('podUrl').validate(customVideosValidators.isVideoPodUrlValid)
46VideoSchema.path('author').validate(customValidators.isVideoAuthorValid) 46VideoSchema.path('author').validate(customVideosValidators.isVideoAuthorValid)
47VideoSchema.path('duration').validate(customValidators.isVideoDurationValid) 47VideoSchema.path('duration').validate(customVideosValidators.isVideoDurationValid)
48// The tumbnail can be the path or the data in base 64 48// The tumbnail can be the path or the data in base 64
49// The pre save hook will convert the base 64 data in a file on disk and replace the thumbnail key by the filename 49// The pre save hook will convert the base 64 data in a file on disk and replace the thumbnail key by the filename
50VideoSchema.path('thumbnail').validate(function (value) { 50VideoSchema.path('thumbnail').validate(function (value) {
51 return customValidators.isVideoThumbnailValid(value) || customValidators.isVideoThumbnail64Valid(value) 51 return customVideosValidators.isVideoThumbnailValid(value) || customVideosValidators.isVideoThumbnail64Valid(value)
52}) 52})
53VideoSchema.path('tags').validate(customValidators.isVideoTagsValid) 53VideoSchema.path('tags').validate(customVideosValidators.isVideoTagsValid)
54 54
55VideoSchema.methods = { 55VideoSchema.methods = {
56 isOwned: isOwned, 56 isOwned: isOwned,