aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-27 21:15:07 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-27 21:16:19 +0200
commit32bb41560279dd0c75d0461f081873483e3aaed9 (patch)
treeef4d621d7f9f5ffcadf437da0e872042312305bc /server/models
parentf24c4e44624058e16d4a09856fac8c409203c59f (diff)
downloadPeerTube-32bb41560279dd0c75d0461f081873483e3aaed9.tar.gz
PeerTube-32bb41560279dd0c75d0461f081873483e3aaed9.tar.zst
PeerTube-32bb41560279dd0c75d0461f081873483e3aaed9.zip
Server: Use ES6 promise for mongoose/node-oatuh2-server
Diffstat (limited to 'server/models')
-rw-r--r--server/models/oauth-client.js2
-rw-r--r--server/models/oauth-token.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/server/models/oauth-client.js b/server/models/oauth-client.js
index 830f68857..45834c5a5 100644
--- a/server/models/oauth-client.js
+++ b/server/models/oauth-client.js
@@ -29,5 +29,5 @@ function loadFirstClient (callback) {
29} 29}
30 30
31function getByIdAndSecret (id, clientSecret) { 31function getByIdAndSecret (id, clientSecret) {
32 return this.findOne({ _id: id, clientSecret: clientSecret }) 32 return this.findOne({ _id: id, clientSecret: clientSecret }).exec()
33} 33}
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js
index 23c698732..f6a814c36 100644
--- a/server/models/oauth-token.js
+++ b/server/models/oauth-token.js
@@ -28,7 +28,7 @@ mongoose.model('OAuthToken', OAuthTokenSchema)
28// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
29 29
30function getByRefreshTokenAndPopulateClient (refreshToken) { 30function getByRefreshTokenAndPopulateClient (refreshToken) {
31 return this.findOne({ refreshToken: refreshToken }).populate('client').then(function (token) { 31 return this.findOne({ refreshToken: refreshToken }).populate('client').exec().then(function (token) {
32 if (!token) return token 32 if (!token) return token
33 33
34 const tokenInfos = { 34 const tokenInfos = {
@@ -47,9 +47,9 @@ function getByRefreshTokenAndPopulateClient (refreshToken) {
47} 47}
48 48
49function getByTokenAndPopulateUser (bearerToken) { 49function getByTokenAndPopulateUser (bearerToken) {
50 return this.findOne({ accessToken: bearerToken }).populate('user') 50 return this.findOne({ accessToken: bearerToken }).populate('user').exec()
51} 51}
52 52
53function getByRefreshToken (refreshToken) { 53function getByRefreshToken (refreshToken) {
54 return this.findOne({ refreshToken: refreshToken }) 54 return this.findOne({ refreshToken: refreshToken }).exec()
55} 55}