From fdfc4d8817953b60a0583258ff0cae075bf6af8a Mon Sep 17 00:00:00 2001 From: Alexander Kjeldaas Date: Sun, 19 Jan 2020 14:18:09 +0100 Subject: [PATCH] Use consistent naming for ..ExpiresAt --- examples/mongodb/model.js | 8 ++++---- examples/postgresql/model.js | 4 ++-- examples/redis/model.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/mongodb/model.js b/examples/mongodb/model.js index 1dc6a1f..8bbaf9d 100755 --- a/examples/mongodb/model.js +++ b/examples/mongodb/model.js @@ -12,11 +12,11 @@ var Schema = mongoose.Schema; mongoose.model('OAuthTokens', new Schema({ accessToken: { type: String }, - accessTokenExpiresOn: { type: Date }, + accessTokenExpiresAt: { type: Date }, client : { type: Object }, // `client` and `user` are required in multiple places, for example `getAccessToken()` clientId: { type: String }, refreshToken: { type: String }, - refreshTokenExpiresOn: { type: Date }, + refreshTokenExpiresAt: { type: Date }, user : { type: Object }, userId: { type: String }, })); @@ -79,11 +79,11 @@ module.exports.getUser = function(username, password) { module.exports.saveToken = function(token, client, user) { var accessToken = new OAuthTokensModel({ accessToken: token.accessToken, - accessTokenExpiresOn: token.accessTokenExpiresOn, + accessTokenExpiresAt: token.accessTokenExpiresAt, client : client, clientId: client.clientId, refreshToken: token.refreshToken, - refreshTokenExpiresOn: token.refreshTokenExpiresOn, + refreshTokenExpiresAt: token.refreshTokenExpiresAt, user : user, userId: user._id, }); diff --git a/examples/postgresql/model.js b/examples/postgresql/model.js index ef95404..e9f5abc 100644 --- a/examples/postgresql/model.js +++ b/examples/postgresql/model.js @@ -73,10 +73,10 @@ module.exports.getUser = function *(username, password) { module.exports.saveAccessToken = function *(token, client, user) { return pg.query('INSERT INTO oauth_tokens(access_token, access_token_expires_on, client_id, refresh_token, refresh_token_expires_on, user_id) VALUES ($1, $2, $3, $4)', [ token.accessToken, - token.accessTokenExpiresOn, + token.accessTokenExpiresAt, client.id, token.refreshToken, - token.refreshTokenExpiresOn, + token.refreshTokenExpiresAt, user.id ]).then(function(result) { return result.rowCount ? result.rows[0] : false; // TODO return object with client: {id: clientId} and user: {id: userId} defined diff --git a/examples/redis/model.js b/examples/redis/model.js index 51e07ff..5f46710 100644 --- a/examples/redis/model.js +++ b/examples/redis/model.js @@ -30,7 +30,7 @@ module.exports.getAccessToken = function(bearerToken) { return { accessToken: token.accessToken, clientId: token.clientId, - expires: token.accessTokenExpiresOn, + expires: token.accessTokenExpiresAt, userId: token.userId }; }); @@ -67,7 +67,7 @@ module.exports.getRefreshToken = function(bearerToken) { return { clientId: token.clientId, - expires: token.refreshTokenExpiresOn, + expires: token.refreshTokenExpiresAt, refreshToken: token.accessToken, userId: token.userId };