diff options
Diffstat (limited to 'server/models/oauth-token.js')
-rw-r--r-- | server/models/oauth-token.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js index f8de4e916..68e7c9ff7 100644 --- a/server/models/oauth-token.js +++ b/server/models/oauth-token.js | |||
@@ -25,6 +25,22 @@ module.exports = function (sequelize, DataTypes) { | |||
25 | } | 25 | } |
26 | }, | 26 | }, |
27 | { | 27 | { |
28 | indexes: [ | ||
29 | { | ||
30 | fields: [ 'refreshToken' ], | ||
31 | unique: true | ||
32 | }, | ||
33 | { | ||
34 | fields: [ 'accessToken' ], | ||
35 | unique: true | ||
36 | }, | ||
37 | { | ||
38 | fields: [ 'userId' ] | ||
39 | }, | ||
40 | { | ||
41 | fields: [ 'oAuthClientId' ] | ||
42 | } | ||
43 | ], | ||
28 | classMethods: { | 44 | classMethods: { |
29 | associate, | 45 | associate, |
30 | 46 | ||
@@ -49,6 +65,14 @@ function associate (models) { | |||
49 | }, | 65 | }, |
50 | onDelete: 'cascade' | 66 | onDelete: 'cascade' |
51 | }) | 67 | }) |
68 | |||
69 | this.belongsTo(models.OAuthClient, { | ||
70 | foreignKey: { | ||
71 | name: 'oAuthClientId', | ||
72 | allowNull: false | ||
73 | }, | ||
74 | onDelete: 'cascade' | ||
75 | }) | ||
52 | } | 76 | } |
53 | 77 | ||
54 | function getByRefreshTokenAndPopulateClient (refreshToken) { | 78 | function getByRefreshTokenAndPopulateClient (refreshToken) { |