aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.js20
-rw-r--r--server/initializers/migrations/0015-video-views.js19
2 files changed, 36 insertions, 3 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 821580893..668bfe56c 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 = 10 8const LAST_MIGRATION_VERSION = 15
9 9
10// --------------------------------------------------------------------------- 10// ---------------------------------------------------------------------------
11 11
@@ -24,7 +24,7 @@ const SEARCHABLE_COLUMNS = {
24const SORTABLE_COLUMNS = { 24const SORTABLE_COLUMNS = {
25 USERS: [ 'id', '-id', 'username', '-username', 'createdAt', '-createdAt' ], 25 USERS: [ 'id', '-id', 'username', '-username', 'createdAt', '-createdAt' ],
26 VIDEO_ABUSES: [ 'id', '-id', 'createdAt', '-createdAt' ], 26 VIDEO_ABUSES: [ 'id', '-id', 'createdAt', '-createdAt' ],
27 VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt' ] 27 VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt', 'views', '-views' ]
28} 28}
29 29
30const OAUTH_LIFETIME = { 30const OAUTH_LIFETIME = {
@@ -116,11 +116,16 @@ const REQUESTS_LIMIT_PODS = 10
116// How many requests we send to a pod per interval 116// How many requests we send to a pod per interval
117const REQUESTS_LIMIT_PER_POD = 5 117const REQUESTS_LIMIT_PER_POD = 5
118 118
119const REQUESTS_VIDEO_QADU_LIMIT_PODS = 10
120// The QADU requests are not big
121const REQUESTS_VIDEO_QADU_LIMIT_PER_POD = 50
122
119// Number of requests to retry for replay requests module 123// Number of requests to retry for replay requests module
120const RETRY_REQUESTS = 5 124const RETRY_REQUESTS = 5
121 125
122const REQUEST_ENDPOINTS = { 126const REQUEST_ENDPOINTS = {
123 VIDEOS: 'videos' 127 VIDEOS: 'videos',
128 QADU: 'videos/qadu'
124} 129}
125const REQUEST_ENDPOINT_ACTIONS = {} 130const REQUEST_ENDPOINT_ACTIONS = {}
126REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = { 131REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = {
@@ -130,6 +135,12 @@ REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = {
130 REPORT_ABUSE: 'report-abuse' 135 REPORT_ABUSE: 'report-abuse'
131} 136}
132 137
138const REQUEST_VIDEO_QADU_TYPES = {
139 LIKES: 'likes',
140 DISLIKES: 'dislikes',
141 VIEWS: 'views'
142}
143
133const REMOTE_SCHEME = { 144const REMOTE_SCHEME = {
134 HTTP: 'https', 145 HTTP: 'https',
135 WS: 'wss' 146 WS: 'wss'
@@ -199,10 +210,13 @@ module.exports = {
199 REMOTE_SCHEME, 210 REMOTE_SCHEME,
200 REQUEST_ENDPOINT_ACTIONS, 211 REQUEST_ENDPOINT_ACTIONS,
201 REQUEST_ENDPOINTS, 212 REQUEST_ENDPOINTS,
213 REQUEST_VIDEO_QADU_TYPES,
202 REQUESTS_IN_PARALLEL, 214 REQUESTS_IN_PARALLEL,
203 REQUESTS_INTERVAL, 215 REQUESTS_INTERVAL,
204 REQUESTS_LIMIT_PER_POD, 216 REQUESTS_LIMIT_PER_POD,
205 REQUESTS_LIMIT_PODS, 217 REQUESTS_LIMIT_PODS,
218 REQUESTS_VIDEO_QADU_LIMIT_PER_POD,
219 REQUESTS_VIDEO_QADU_LIMIT_PODS,
206 RETRY_REQUESTS, 220 RETRY_REQUESTS,
207 SEARCHABLE_COLUMNS, 221 SEARCHABLE_COLUMNS,
208 SIGNATURE_ALGORITHM, 222 SIGNATURE_ALGORITHM,
diff --git a/server/initializers/migrations/0015-video-views.js b/server/initializers/migrations/0015-video-views.js
new file mode 100644
index 000000000..ae49fe73c
--- /dev/null
+++ b/server/initializers/migrations/0015-video-views.js
@@ -0,0 +1,19 @@
1'use strict'
2
3// utils = { transaction, queryInterface, sequelize, Sequelize }
4exports.up = function (utils, finalCallback) {
5 const q = utils.queryInterface
6 const Sequelize = utils.Sequelize
7
8 const data = {
9 type: Sequelize.INTEGER,
10 allowNull: false,
11 defaultValue: 0
12 }
13
14 q.addColumn('Videos', 'views', data, { transaction: utils.transaction }).asCallback(finalCallback)
15}
16
17exports.down = function (options, callback) {
18 throw new Error('Not implemented.')
19}