From 31b59b477459d4f26ed8ef089a0e5553fb6a332b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Mar 2017 21:19:46 +0200 Subject: Server: add nsfw attribute --- server/models/video.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'server/models') 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) { } } }, + nsfw: { + type: DataTypes.BOOLEAN, + allowNull: false, + validate: { + nsfwValid: function (value) { + const res = customVideosValidators.isVideoNSFWValid(value) + if (res === false) throw new Error('Video nsfw attribute is not valid.') + } + } + }, description: { type: DataTypes.STRING, allowNull: false, @@ -395,6 +405,7 @@ function toFormatedJSON () { categoryLabel, licence: this.licence, licenceLabel, + nsfw: this.nsfw, description: this.description, podHost, isLocal: this.isOwned(), @@ -428,6 +439,7 @@ function toAddRemoteJSON (callback) { name: self.name, category: self.category, licence: self.licence, + nsfw: self.nsfw, description: self.description, infoHash: self.infoHash, remoteId: self.id, @@ -452,6 +464,7 @@ function toUpdateRemoteJSON (callback) { name: this.name, category: this.category, licence: this.licence, + nsfw: this.nsfw, description: this.description, infoHash: this.infoHash, remoteId: this.id, -- cgit v1.2.3