diff options
Diffstat (limited to 'server/models/oauth-client.js')
-rw-r--r-- | server/models/oauth-client.js | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/server/models/oauth-client.js b/server/models/oauth-client.js deleted file mode 100644 index 021a34007..000000000 --- a/server/models/oauth-client.js +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | module.exports = function (sequelize, DataTypes) { | ||
4 | const OAuthClient = sequelize.define('OAuthClient', | ||
5 | { | ||
6 | clientId: { | ||
7 | type: DataTypes.STRING, | ||
8 | allowNull: false | ||
9 | }, | ||
10 | clientSecret: { | ||
11 | type: DataTypes.STRING, | ||
12 | allowNull: false | ||
13 | }, | ||
14 | grants: { | ||
15 | type: DataTypes.ARRAY(DataTypes.STRING) | ||
16 | }, | ||
17 | redirectUris: { | ||
18 | type: DataTypes.ARRAY(DataTypes.STRING) | ||
19 | } | ||
20 | }, | ||
21 | { | ||
22 | indexes: [ | ||
23 | { | ||
24 | fields: [ 'clientId' ], | ||
25 | unique: true | ||
26 | }, | ||
27 | { | ||
28 | fields: [ 'clientId', 'clientSecret' ], | ||
29 | unique: true | ||
30 | } | ||
31 | ], | ||
32 | classMethods: { | ||
33 | countTotal, | ||
34 | getByIdAndSecret, | ||
35 | loadFirstClient | ||
36 | } | ||
37 | } | ||
38 | ) | ||
39 | |||
40 | return OAuthClient | ||
41 | } | ||
42 | |||
43 | // --------------------------------------------------------------------------- | ||
44 | |||
45 | function countTotal (callback) { | ||
46 | return this.count().asCallback(callback) | ||
47 | } | ||
48 | |||
49 | function loadFirstClient (callback) { | ||
50 | return this.findOne().asCallback(callback) | ||
51 | } | ||
52 | |||
53 | function getByIdAndSecret (clientId, clientSecret) { | ||
54 | const query = { | ||
55 | where: { | ||
56 | clientId: clientId, | ||
57 | clientSecret: clientSecret | ||
58 | } | ||
59 | } | ||
60 | |||
61 | return this.findOne(query) | ||
62 | } | ||