Ghost/core/server/models/index.js
cobbspur 9430f5fa51 Add token added event, update last_login
closes #6845

- emit token.added event when new access token is created
- update last_login for user token.added event is triggered
2016-06-09 09:17:06 +01:00

49 lines
633 B
JavaScript

/**
* Dependencies
*/
var _ = require('lodash'),
exports,
models;
// Initialise model events
require('./base/events');
/**
* Expose all models
*/
exports = module.exports;
models = [
'accesstoken',
'app-field',
'app-setting',
'app',
'client-trusted-domain',
'client',
'permission',
'post',
'refreshtoken',
'role',
'settings',
'subscriber',
'tag',
'user'
];
function init() {
exports.Base = require('./base');
models.forEach(function (name) {
_.extend(exports, require('./' + name));
});
}
/**
* Expose `init`
*/
exports.init = init;