aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
commit6f0c39e2de400685b7baf8340b9e132f2659365a (patch)
treeb036c6ebf65ff4cb7f5649fc48a0b7201370bddd /server/initializers
parent28974889281523eec5b00dd5596c67d99c5167e5 (diff)
downloadPeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.gz
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.zst
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.zip
Server: add licence video attribute
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.js14
-rw-r--r--server/initializers/migrations/0035-video-licence.js34
2 files changed, 47 insertions, 1 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 40f01e389..af494cb66 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -5,7 +5,7 @@ const path = require('path')
5 5
6// --------------------------------------------------------------------------- 6// ---------------------------------------------------------------------------
7 7
8const LAST_MIGRATION_VERSION = 30 8const LAST_MIGRATION_VERSION = 35
9 9
10// --------------------------------------------------------------------------- 10// ---------------------------------------------------------------------------
11 11
@@ -124,6 +124,17 @@ const VIDEO_CATEGORIES = {
124 18: 'Food' 124 18: 'Food'
125} 125}
126 126
127// See https://creativecommons.org/licenses/?lang=en
128const VIDEO_LICENCES = {
129 1: 'Attribution',
130 2: 'Attribution - Share Alike',
131 3: 'Attribution - No Derivatives',
132 4: 'Attribution - Non Commercial',
133 5: 'Attribution - Non Commercial - Share Alike',
134 6: 'Attribution - Non Commercial - No Derivatives',
135 7: 'Public Domain Dedication'
136}
137
127// --------------------------------------------------------------------------- 138// ---------------------------------------------------------------------------
128 139
129// Score a pod has when we create it as a friend 140// Score a pod has when we create it as a friend
@@ -280,6 +291,7 @@ module.exports = {
280 THUMBNAILS_SIZE, 291 THUMBNAILS_SIZE,
281 USER_ROLES, 292 USER_ROLES,
282 VIDEO_CATEGORIES, 293 VIDEO_CATEGORIES,
294 VIDEO_LICENCES,
283 VIDEO_RATE_TYPES 295 VIDEO_RATE_TYPES
284} 296}
285 297
diff --git a/server/initializers/migrations/0035-video-licence.js b/server/initializers/migrations/0035-video-licence.js
new file mode 100644
index 000000000..9cf75858d
--- /dev/null
+++ b/server/initializers/migrations/0035-video-licence.js
@@ -0,0 +1,34 @@
1'use strict'
2
3const waterfall = require('async/waterfall')
4
5// utils = { transaction, queryInterface, sequelize, Sequelize }
6exports.up = function (utils, finalCallback) {
7 const q = utils.queryInterface
8 const Sequelize = utils.Sequelize
9
10 const data = {
11 type: Sequelize.INTEGER,
12 allowNull: false,
13 defaultValue: 0
14 }
15
16 waterfall([
17
18 function addLicenceColumn (callback) {
19 q.addColumn('Videos', 'licence', data, { transaction: utils.transaction }).asCallback(function (err) {
20 return callback(err)
21 })
22 },
23
24 function nullOnDefault (callback) {
25 data.defaultValue = null
26
27 q.changeColumn('Videos', 'licence', data, { transaction: utils.transaction }).asCallback(callback)
28 }
29 ], finalCallback)
30}
31
32exports.down = function (options, callback) {
33 throw new Error('Not implemented.')
34}