aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/models/video.js b/server/models/video.js
index 0f44b98c3..86d6438c8 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -71,6 +71,16 @@ module.exports = function (sequelize, DataTypes) {
71 } 71 }
72 } 72 }
73 }, 73 },
74 nsfw: {
75 type: DataTypes.BOOLEAN,
76 allowNull: false,
77 validate: {
78 nsfwValid: function (value) {
79 const res = customVideosValidators.isVideoNSFWValid(value)
80 if (res === false) throw new Error('Video nsfw attribute is not valid.')
81 }
82 }
83 },
74 description: { 84 description: {
75 type: DataTypes.STRING, 85 type: DataTypes.STRING,
76 allowNull: false, 86 allowNull: false,
@@ -395,6 +405,7 @@ function toFormatedJSON () {
395 categoryLabel, 405 categoryLabel,
396 licence: this.licence, 406 licence: this.licence,
397 licenceLabel, 407 licenceLabel,
408 nsfw: this.nsfw,
398 description: this.description, 409 description: this.description,
399 podHost, 410 podHost,
400 isLocal: this.isOwned(), 411 isLocal: this.isOwned(),
@@ -428,6 +439,7 @@ function toAddRemoteJSON (callback) {
428 name: self.name, 439 name: self.name,
429 category: self.category, 440 category: self.category,
430 licence: self.licence, 441 licence: self.licence,
442 nsfw: self.nsfw,
431 description: self.description, 443 description: self.description,
432 infoHash: self.infoHash, 444 infoHash: self.infoHash,
433 remoteId: self.id, 445 remoteId: self.id,
@@ -452,6 +464,7 @@ function toUpdateRemoteJSON (callback) {
452 name: this.name, 464 name: this.name,
453 category: this.category, 465 category: this.category,
454 licence: this.licence, 466 licence: this.licence,
467 nsfw: this.nsfw,
455 description: this.description, 468 description: this.description,
456 infoHash: this.infoHash, 469 infoHash: this.infoHash,
457 remoteId: this.id, 470 remoteId: this.id,