do not use userdb directly

This commit is contained in:
Girish Ramakrishnan
2016-06-07 09:59:29 -07:00
parent 3ae388602c
commit dc8fd2eab3
3 changed files with 27 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ exports = module.exports = {
list: listUsers,
create: createUser,
count: count,
verify: verify,
verifyWithUsername: verifyWithUsername,
verifyWithEmail: verifyWithEmail,
@@ -286,6 +287,16 @@ function listUsers(callback) {
});
}
function count(callback) {
assert.strictEqual(typeof callback, 'function');
userdb.count(function (error, count) {
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
callback(null, count);
});
}
function getUser(userId, callback) {
assert.strictEqual(typeof userId, 'string');
assert.strictEqual(typeof callback, 'function');