diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-01 16:03:53 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-01 16:03:53 +0200 |
commit | 69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd (patch) | |
tree | 8659f819818a3da6419959b6b7838a7f0557c948 /server/initializers/checker.js | |
parent | a3ee6fa22dee4b68fcde9cd23708b471db446e11 (diff) | |
download | PeerTube-69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd.tar.gz PeerTube-69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd.tar.zst PeerTube-69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd.zip |
OAuth/User models refractoring -> use mongoose api
Diffstat (limited to 'server/initializers/checker.js')
-rw-r--r-- | server/initializers/checker.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/initializers/checker.js b/server/initializers/checker.js index 7a2b5b132..3831efb8d 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js | |||
@@ -1,8 +1,10 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const config = require('config') | 3 | const config = require('config') |
4 | const mongoose = require('mongoose') | ||
4 | 5 | ||
5 | const Users = require('../models/users') | 6 | const Client = mongoose.model('OAuthClient') |
7 | const User = mongoose.model('User') | ||
6 | 8 | ||
7 | const checker = { | 9 | const checker = { |
8 | checkConfig: checkConfig, | 10 | checkConfig: checkConfig, |
@@ -29,7 +31,7 @@ function checkConfig () { | |||
29 | } | 31 | } |
30 | 32 | ||
31 | function clientsExist (callback) { | 33 | function clientsExist (callback) { |
32 | Users.getClients(function (err, clients) { | 34 | Client.list(function (err, clients) { |
33 | if (err) return callback(err) | 35 | if (err) return callback(err) |
34 | 36 | ||
35 | return callback(null, clients.length !== 0) | 37 | return callback(null, clients.length !== 0) |
@@ -37,7 +39,7 @@ function clientsExist (callback) { | |||
37 | } | 39 | } |
38 | 40 | ||
39 | function usersExist (callback) { | 41 | function usersExist (callback) { |
40 | Users.getUsers(function (err, users) { | 42 | User.list(function (err, users) { |
41 | if (err) return callback(err) | 43 | if (err) return callback(err) |
42 | 44 | ||
43 | return callback(null, users.length !== 0) | 45 | return callback(null, users.length !== 0) |