mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
6f6c8f4521
refs #9178 - avoid importing 4 modules (logging, errors, events and i18n) - simply require common in each file
29 lines
757 B
JavaScript
29 lines
757 B
JavaScript
var ghostBookshelf = require('./base'),
|
|
Basetoken = require('./base/token'),
|
|
common = require('../lib/common'),
|
|
|
|
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
|
|
common.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)
|
|
};
|