Fixes in DB

parent 29bb5b92
......@@ -13,9 +13,9 @@ exports.saveCode = function(code, userId, scope, clientId, redirect, callback) {
};
exports.getCode = function (code, callback) {
dbUtils.dbFindOne(Code, {code: code}, callback);
dbUtils.dbFindOne(Code, {code: code}, [{ path: 'client', select: 'client' }, { path: 'user', select: 'username' }], callback);
};
exports.removeCode = function (token, callback) {
exports.removeCode = function (code, callback) {
dbUtils.dbRemoveItem(Code, {code: code}, callback);
};
......@@ -12,7 +12,7 @@ var RefreshToken = require('./models/mongoose').RefreshToken;
// AccessToken
exports.saveAccessToken = function(token, userId, scope, refreshToken, callback) {
dbUtils.dbCreateItem(AccessToken,{token: token, refreshToken: refreshToken, userId: userId, scope: scope}, callback);
dbUtils.dbCreateItem(AccessToken,{token: token, refreshToken: refreshToken, user: userId, scope: scope}, callback);
};
exports.getAccessToken = function (token, callback) {
......@@ -30,11 +30,11 @@ exports.removeAccessTokenByRefresh = function (token, callback) {
// RefreshToken
exports.saveRefreshToken = function(token, userId, scope, clientId, callback) {
dbUtils.dbCreateItem(RefreshToken,{ token: token, userId: userId, scope: scope, client: clientId }, callback);
dbUtils.dbCreateItem(RefreshToken,{ token: token, user: userId, scope: scope, client: clientId }, callback);
};
exports.getRefreshToken = function (token, callback) {
dbUtils.dbFindOne(RefreshToken, {token: token}, callback);
dbUtils.dbFindOne(RefreshToken, {token: token}, [{ path: 'client', select: 'client' }, { path: 'user', select: 'username' }], callback);
};
exports.removeRefreshToken = function (token, callback) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment