2017-12-12 00:47:46 +03:00
|
|
|
var ghostBookshelf = require('./base'),
|
|
|
|
Basetoken = require('./base/token'),
|
|
|
|
common = require('../lib/common'),
|
2014-06-30 16:58:10 +04:00
|
|
|
|
|
|
|
Accesstoken,
|
|
|
|
Accesstokens;
|
|
|
|
|
2014-07-14 16:29:45 +04:00
|
|
|
Accesstoken = Basetoken.extend({
|
2016-06-01 19:46:41 +03:00
|
|
|
tableName: 'accesstokens',
|
|
|
|
|
|
|
|
emitChange: function emitChange(event) {
|
|
|
|
// Event named 'token' as access and refresh token will be merged in future, see #6626
|
2017-12-12 00:47:46 +03:00
|
|
|
common.events.emit('token' + '.' + event, this);
|
2016-06-01 19:46:41 +03:00
|
|
|
},
|
|
|
|
|
2016-10-14 15:37:01 +03:00
|
|
|
onCreated: function onCreated(model) {
|
|
|
|
model.emitChange('added');
|
2016-06-01 19:46:41 +03:00
|
|
|
}
|
2014-06-30 16:58:10 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
Accesstokens = ghostBookshelf.Collection.extend({
|
|
|
|
model: Accesstoken
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = {
|
2014-07-13 15:17:18 +04:00
|
|
|
Accesstoken: ghostBookshelf.model('Accesstoken', Accesstoken),
|
|
|
|
Accesstokens: ghostBookshelf.collection('Accesstokens', Accesstokens)
|
2014-09-10 08:06:24 +04:00
|
|
|
};
|