api/models/Client.js
/**
* Client
*
* @description :: A model that defines the data structure of client details
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
name: {
type: 'string',
required: true
},
redirectURI: {
type: 'string',
required: true
},
clientId: 'string',
clientSecret: 'string',
trusted: {
type: 'boolean',
defaultsTo: false
}
},
beforeCreate: function (values, next) {
values.clientId = UtilsService.uidLight(10);
values.clientSecret = UtilsService.uid(30);
next();
}
};