1 module.exports = function (sequelize, DataTypes) {
2 const OAuthClient = sequelize.define('OAuthClient',
11 type: DataTypes.ARRAY(DataTypes.STRING)
14 type: DataTypes.ARRAY(DataTypes.STRING)
32 // OAuthClientSchema.path('clientSecret').required(true)
34 // ---------------------------------------------------------------------------
36 function associate (models) {
37 this.hasMany(models.OAuthToken, {
39 name: 'oAuthClientId',
46 function list (callback) {
47 return this.findAll().asCallback(callback)
50 function loadFirstClient (callback) {
51 return this.findOne().asCallback(callback)
54 function getByIdAndSecret (clientId, clientSecret) {
58 clientSecret: clientSecret
62 return this.findOne(query)