diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-31 20:58:43 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-31 20:58:43 +0200 |
commit | e4c556196d7b31111f17596840d2e1d60caa7dcb (patch) | |
tree | 41be84f002600aa0153ac09cc5d79fdd90d126e3 /server/models | |
parent | e62f6ef741c8d14817e321c554796ad64ea7ae1b (diff) | |
download | PeerTube-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.js | 18 |
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') | |||
9 | const mongoose = require('mongoose') | 9 | const mongoose = require('mongoose') |
10 | 10 | ||
11 | const constants = require('../initializers/constants') | 11 | const constants = require('../initializers/constants') |
12 | const customValidators = require('../helpers/custom-validators') | 12 | const customVideosValidators = require('../helpers/custom-validators').videos |
13 | const logger = require('../helpers/logger') | 13 | const logger = require('../helpers/logger') |
14 | const utils = require('../helpers/utils') | 14 | const utils = require('../helpers/utils') |
15 | const webtorrent = require('../lib/webtorrent') | 15 | const webtorrent = require('../lib/webtorrent') |
@@ -39,18 +39,18 @@ const VideoSchema = mongoose.Schema({ | |||
39 | } | 39 | } |
40 | }) | 40 | }) |
41 | 41 | ||
42 | VideoSchema.path('name').validate(customValidators.isVideoNameValid) | 42 | VideoSchema.path('name').validate(customVideosValidators.isVideoNameValid) |
43 | VideoSchema.path('description').validate(customValidators.isVideoDescriptionValid) | 43 | VideoSchema.path('description').validate(customVideosValidators.isVideoDescriptionValid) |
44 | VideoSchema.path('magnetUri').validate(customValidators.isVideoMagnetUriValid) | 44 | VideoSchema.path('magnetUri').validate(customVideosValidators.isVideoMagnetUriValid) |
45 | VideoSchema.path('podUrl').validate(customValidators.isVideoPodUrlValid) | 45 | VideoSchema.path('podUrl').validate(customVideosValidators.isVideoPodUrlValid) |
46 | VideoSchema.path('author').validate(customValidators.isVideoAuthorValid) | 46 | VideoSchema.path('author').validate(customVideosValidators.isVideoAuthorValid) |
47 | VideoSchema.path('duration').validate(customValidators.isVideoDurationValid) | 47 | VideoSchema.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 |
50 | VideoSchema.path('thumbnail').validate(function (value) { | 50 | VideoSchema.path('thumbnail').validate(function (value) { |
51 | return customValidators.isVideoThumbnailValid(value) || customValidators.isVideoThumbnail64Valid(value) | 51 | return customVideosValidators.isVideoThumbnailValid(value) || customVideosValidators.isVideoThumbnail64Valid(value) |
52 | }) | 52 | }) |
53 | VideoSchema.path('tags').validate(customValidators.isVideoTagsValid) | 53 | VideoSchema.path('tags').validate(customVideosValidators.isVideoTagsValid) |
54 | 54 | ||
55 | VideoSchema.methods = { | 55 | VideoSchema.methods = { |
56 | isOwned: isOwned, | 56 | isOwned: isOwned, |