aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-client.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/oauth-client.js')
-rw-r--r--server/models/oauth-client.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/server/models/oauth-client.js b/server/models/oauth-client.js
index b56838d4c..758c4cf2f 100644
--- a/server/models/oauth-client.js
+++ b/server/models/oauth-client.js
@@ -19,9 +19,17 @@ module.exports = function (sequelize, DataTypes) {
19 } 19 }
20 }, 20 },
21 { 21 {
22 indexes: [
23 {
24 fields: [ 'clientId' ],
25 unique: true
26 },
27 {
28 fields: [ 'clientId', 'clientSecret' ],
29 unique: true
30 }
31 ],
22 classMethods: { 32 classMethods: {
23 associate,
24
25 getByIdAndSecret, 33 getByIdAndSecret,
26 list, 34 list,
27 loadFirstClient 35 loadFirstClient
@@ -34,16 +42,6 @@ module.exports = function (sequelize, DataTypes) {
34 42
35// --------------------------------------------------------------------------- 43// ---------------------------------------------------------------------------
36 44
37function associate (models) {
38 this.hasMany(models.OAuthToken, {
39 foreignKey: {
40 name: 'oAuthClientId',
41 allowNull: false
42 },
43 onDelete: 'cascade'
44 })
45}
46
47function list (callback) { 45function list (callback) {
48 return this.findAll().asCallback(callback) 46 return this.findAll().asCallback(callback)
49} 47}