aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
commitf0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch)
tree99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/models
parent5101105ef91bfe478f97546b78b321882da2079c (diff)
downloadPeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.gz
PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.zst
PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.zip
Use const/let now we use node 4.2
Diffstat (limited to 'server/models')
-rw-r--r--server/models/pods.js14
-rw-r--r--server/models/poolRequests.js10
-rw-r--r--server/models/videos.js36
3 files changed, 30 insertions, 30 deletions
diff --git a/server/models/pods.js b/server/models/pods.js
index 57ed20292..4e21001f5 100644
--- a/server/models/pods.js
+++ b/server/models/pods.js
@@ -1,22 +1,22 @@
1'use strict' 1'use strict'
2 2
3var mongoose = require('mongoose') 3const mongoose = require('mongoose')
4 4
5var constants = require('../initializers/constants') 5const constants = require('../initializers/constants')
6var logger = require('../helpers/logger') 6const logger = require('../helpers/logger')
7 7
8// --------------------------------------------------------------------------- 8// ---------------------------------------------------------------------------
9 9
10var podsSchema = mongoose.Schema({ 10const podsSchema = mongoose.Schema({
11 url: String, 11 url: String,
12 publicKey: String, 12 publicKey: String,
13 score: { type: Number, max: constants.FRIEND_BASE_SCORE } 13 score: { type: Number, max: constants.FRIEND_BASE_SCORE }
14}) 14})
15var PodsDB = mongoose.model('pods', podsSchema) 15const PodsDB = mongoose.model('pods', podsSchema)
16 16
17// --------------------------------------------------------------------------- 17// ---------------------------------------------------------------------------
18 18
19var Pods = { 19const Pods = {
20 add: add, 20 add: add,
21 count: count, 21 count: count,
22 findByUrl: findByUrl, 22 findByUrl: findByUrl,
@@ -31,7 +31,7 @@ var Pods = {
31// TODO: check if the pod is not already a friend 31// TODO: check if the pod is not already a friend
32function add (data, callback) { 32function add (data, callback) {
33 if (!callback) callback = function () {} 33 if (!callback) callback = function () {}
34 var params = { 34 const params = {
35 url: data.url, 35 url: data.url,
36 publicKey: data.publicKey, 36 publicKey: data.publicKey,
37 score: constants.FRIEND_BASE_SCORE 37 score: constants.FRIEND_BASE_SCORE
diff --git a/server/models/poolRequests.js b/server/models/poolRequests.js
index 970315597..28093a94c 100644
--- a/server/models/poolRequests.js
+++ b/server/models/poolRequests.js
@@ -1,21 +1,21 @@
1'use strict' 1'use strict'
2 2
3var mongoose = require('mongoose') 3const mongoose = require('mongoose')
4 4
5var logger = require('../helpers/logger') 5const logger = require('../helpers/logger')
6 6
7// --------------------------------------------------------------------------- 7// ---------------------------------------------------------------------------
8 8
9var poolRequestsSchema = mongoose.Schema({ 9const poolRequestsSchema = mongoose.Schema({
10 type: String, 10 type: String,
11 id: String, // Special id to find duplicates (video created we want to remove...) 11 id: String, // Special id to find duplicates (video created we want to remove...)
12 request: mongoose.Schema.Types.Mixed 12 request: mongoose.Schema.Types.Mixed
13}) 13})
14var PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema) 14const PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema)
15 15
16// --------------------------------------------------------------------------- 16// ---------------------------------------------------------------------------
17 17
18var PoolRequests = { 18const PoolRequests = {
19 create: create, 19 create: create,
20 findById: findById, 20 findById: findById,
21 list: list, 21 list: list,
diff --git a/server/models/videos.js b/server/models/videos.js
index fd02ec9e1..0141cbb7f 100644
--- a/server/models/videos.js
+++ b/server/models/videos.js
@@ -1,33 +1,33 @@
1'use strict' 1'use strict'
2 2
3var async = require('async') 3const async = require('async')
4var config = require('config') 4const config = require('config')
5var dz = require('dezalgo') 5const dz = require('dezalgo')
6var fs = require('fs') 6const fs = require('fs')
7var mongoose = require('mongoose') 7const mongoose = require('mongoose')
8var path = require('path') 8const path = require('path')
9 9
10var logger = require('../helpers/logger') 10const logger = require('../helpers/logger')
11 11
12var http = config.get('webserver.https') === true ? 'https' : 'http' 12const http = config.get('webserver.https') === true ? 'https' : 'http'
13var host = config.get('webserver.host') 13const host = config.get('webserver.host')
14var port = config.get('webserver.port') 14const port = config.get('webserver.port')
15var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) 15const uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads'))
16 16
17// --------------------------------------------------------------------------- 17// ---------------------------------------------------------------------------
18 18
19var videosSchema = mongoose.Schema({ 19const videosSchema = mongoose.Schema({
20 name: String, 20 name: String,
21 namePath: String, 21 namePath: String,
22 description: String, 22 description: String,
23 magnetUri: String, 23 magnetUri: String,
24 podUrl: String 24 podUrl: String
25}) 25})
26var VideosDB = mongoose.model('videos', videosSchema) 26const VideosDB = mongoose.model('videos', videosSchema)
27 27
28// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
29 29
30var Videos = { 30const Videos = {
31 add: add, 31 add: add,
32 addRemotes: addRemotes, 32 addRemotes: addRemotes,
33 get: get, 33 get: get,
@@ -43,7 +43,7 @@ var Videos = {
43function add (video, callback) { 43function add (video, callback) {
44 logger.info('Adding %s video to database.', video.name) 44 logger.info('Adding %s video to database.', video.name)
45 45
46 var params = video 46 const params = video
47 params.podUrl = http + '://' + host + ':' + port 47 params.podUrl = http + '://' + host + ':' + port
48 48
49 VideosDB.create(params, function (err, video) { 49 VideosDB.create(params, function (err, video) {
@@ -60,13 +60,13 @@ function add (video, callback) {
60function addRemotes (videos, callback) { 60function addRemotes (videos, callback) {
61 if (!callback) callback = function () {} 61 if (!callback) callback = function () {}
62 62
63 var to_add = [] 63 const to_add = []
64 64
65 async.each(videos, function (video, callback_each) { 65 async.each(videos, function (video, callback_each) {
66 callback_each = dz(callback_each) 66 callback_each = dz(callback_each)
67 logger.debug('Add remote video from pod: %s', video.podUrl) 67 logger.debug('Add remote video from pod: %s', video.podUrl)
68 68
69 var params = { 69 const params = {
70 name: video.name, 70 name: video.name,
71 namePath: null, 71 namePath: null,
72 description: video.description, 72 description: video.description,
@@ -159,7 +159,7 @@ function removeRemotesOfByMagnetUris (fromUrl, magnetUris, callback) {
159 return callback(err) 159 return callback(err)
160 } 160 }
161 161
162 var to_remove = [] 162 const to_remove = []
163 async.each(videos, function (video, callback_async) { 163 async.each(videos, function (video, callback_async) {
164 callback_async = dz(callback_async) 164 callback_async = dz(callback_async)
165 165