2015-10-06 16:36:56 +03:00
|
|
|
/**
|
|
|
|
* Dependencies
|
|
|
|
*/
|
|
|
|
|
2020-04-29 18:44:27 +03:00
|
|
|
const _ = require('lodash');
|
2021-10-21 19:01:26 +03:00
|
|
|
const glob = require('glob');
|
2013-06-01 18:47:41 +04:00
|
|
|
|
2016-06-10 10:37:55 +03:00
|
|
|
// enable event listeners
|
|
|
|
require('./base/listeners');
|
2016-06-01 19:46:41 +03:00
|
|
|
|
2015-10-06 16:36:56 +03:00
|
|
|
/**
|
|
|
|
* Expose all models
|
|
|
|
*/
|
|
|
|
exports = module.exports;
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
exports.Base = require('./base');
|
|
|
|
|
2021-10-21 19:01:26 +03:00
|
|
|
let modelsFiles = glob.sync('!(index).js', {cwd: __dirname});
|
|
|
|
modelsFiles.forEach((model) => {
|
|
|
|
const name = model.replace(/.js$/, '');
|
2015-10-06 16:36:56 +03:00
|
|
|
_.extend(exports, require('./' + name));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Expose `init`
|
|
|
|
*/
|
|
|
|
|
|
|
|
exports.init = init;
|