aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/pods.js4
-rw-r--r--server/models/users.js20
-rw-r--r--server/models/videos.js8
3 files changed, 16 insertions, 16 deletions
diff --git a/server/models/pods.js b/server/models/pods.js
index 4e21001f5..04cc2d6fc 100644
--- a/server/models/pods.js
+++ b/server/models/pods.js
@@ -58,13 +58,13 @@ function incrementScores (ids, value, callback) {
58} 58}
59 59
60function list (callback) { 60function list (callback) {
61 PodsDB.find(function (err, pods_list) { 61 PodsDB.find(function (err, podsList) {
62 if (err) { 62 if (err) {
63 logger.error('Cannot get the list of the pods.') 63 logger.error('Cannot get the list of the pods.')
64 return callback(err) 64 return callback(err)
65 } 65 }
66 66
67 return callback(null, pods_list) 67 return callback(null, podsList)
68 }) 68 })
69} 69}
70 70
diff --git a/server/models/users.js b/server/models/users.js
index a852bf25b..a1bdece23 100644
--- a/server/models/users.js
+++ b/server/models/users.js
@@ -45,11 +45,11 @@ const Users = {
45function createClient (secret, grants, callback) { 45function createClient (secret, grants, callback) {
46 logger.debug('Creating client.') 46 logger.debug('Creating client.')
47 47
48 const mongo_id = new mongoose.mongo.ObjectID() 48 const mongoId = new mongoose.mongo.ObjectID()
49 return OAuthClientsDB.create({ _id: mongo_id, clientSecret: secret, grants: grants }, function (err) { 49 return OAuthClientsDB.create({ _id: mongoId, clientSecret: secret, grants: grants }, function (err) {
50 if (err) return callback(err) 50 if (err) return callback(err)
51 51
52 return callback(null, mongo_id) 52 return callback(null, mongoId)
53 }) 53 })
54} 54}
55 55
@@ -73,8 +73,8 @@ function getClient (clientId, clientSecret) {
73 logger.debug('Getting Client (clientId: ' + clientId + ', clientSecret: ' + clientSecret + ').') 73 logger.debug('Getting Client (clientId: ' + clientId + ', clientSecret: ' + clientSecret + ').')
74 74
75 // TODO req validator 75 // TODO req validator
76 const mongo_id = new mongoose.mongo.ObjectID(clientId) 76 const mongoId = new mongoose.mongo.ObjectID(clientId)
77 return OAuthClientsDB.findOne({ _id: mongo_id, clientSecret: clientSecret }) 77 return OAuthClientsDB.findOne({ _id: mongoId, clientSecret: clientSecret })
78} 78}
79 79
80function getClients (callback) { 80function getClients (callback) {
@@ -99,7 +99,7 @@ function getUsers (callback) {
99function saveToken (token, client, user) { 99function saveToken (token, client, user) {
100 logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.') 100 logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.')
101 101
102 const token_to_create = { 102 const tokenToCreate = {
103 accessToken: token.accessToken, 103 accessToken: token.accessToken,
104 accessTokenExpiresOn: token.accessTokenExpiresOn, 104 accessTokenExpiresOn: token.accessTokenExpiresOn,
105 client: client.id, 105 client: client.id,
@@ -108,13 +108,13 @@ function saveToken (token, client, user) {
108 user: user.id 108 user: user.id
109 } 109 }
110 110
111 return OAuthTokensDB.create(token_to_create, function (err, token_created) { 111 return OAuthTokensDB.create(tokenToCreate, function (err, tokenCreated) {
112 if (err) throw err // node-oauth2-server library uses Promise.try 112 if (err) throw err // node-oauth2-server library uses Promise.try
113 113
114 token_created.client = client 114 tokenCreated.client = client
115 token_created.user = user 115 tokenCreated.user = user
116 116
117 return token_created 117 return tokenCreated
118 }) 118 })
119} 119}
120 120
diff --git a/server/models/videos.js b/server/models/videos.js
index eedb6eb58..eaea35b7f 100644
--- a/server/models/videos.js
+++ b/server/models/videos.js
@@ -77,13 +77,13 @@ function get (id, callback) {
77} 77}
78 78
79function list (callback) { 79function list (callback) {
80 VideosDB.find(function (err, videos_list) { 80 VideosDB.find(function (err, videosList) {
81 if (err) { 81 if (err) {
82 logger.error('Cannot get the list of the videos.') 82 logger.error('Cannot get the list of the videos.')
83 return callback(err) 83 return callback(err)
84 } 84 }
85 85
86 return callback(null, videos_list) 86 return callback(null, videosList)
87 }) 87 })
88} 88}
89 89
@@ -105,13 +105,13 @@ function listFromRemotes (callback) {
105 105
106function listOwned (callback) { 106function listOwned (callback) {
107 // If namePath is not null this is *our* video 107 // If namePath is not null this is *our* video
108 VideosDB.find({ namePath: { $ne: null } }, function (err, videos_list) { 108 VideosDB.find({ namePath: { $ne: null } }, function (err, videosList) {
109 if (err) { 109 if (err) {
110 logger.error('Cannot get the list of owned videos.') 110 logger.error('Cannot get the list of owned videos.')
111 return callback(err) 111 return callback(err)
112 } 112 }
113 113
114 return callback(null, videos_list) 114 return callback(null, videosList)
115 }) 115 })
116} 116}
117 117