mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
ac2578b419
refs #9178
29 lines
772 B
JavaScript
29 lines
772 B
JavaScript
var ghostBookshelf = require('./base'),
|
|
Basetoken = require('./base/token'),
|
|
events = require('../lib/common/events'),
|
|
|
|
Accesstoken,
|
|
Accesstokens;
|
|
|
|
Accesstoken = Basetoken.extend({
|
|
tableName: 'accesstokens',
|
|
|
|
emitChange: function emitChange(event) {
|
|
// Event named 'token' as access and refresh token will be merged in future, see #6626
|
|
events.emit('token' + '.' + event, this);
|
|
},
|
|
|
|
onCreated: function onCreated(model) {
|
|
model.emitChange('added');
|
|
}
|
|
});
|
|
|
|
Accesstokens = ghostBookshelf.Collection.extend({
|
|
model: Accesstoken
|
|
});
|
|
|
|
module.exports = {
|
|
Accesstoken: ghostBookshelf.model('Accesstoken', Accesstoken),
|
|
Accesstokens: ghostBookshelf.collection('Accesstokens', Accesstokens)
|
|
};
|