2020-01-14 23:26:39 +01:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = sequelize => {
|
|
|
|
const modelNames = [ // This is the order required to correctly get references.
|
|
|
|
'PermissionLevel',
|
|
|
|
'User',
|
|
|
|
'BookReference',
|
|
|
|
'Shelf',
|
|
|
|
'ShelfItem',
|
|
|
|
'Status',
|
|
|
|
'Review',
|
|
|
|
'Recommendation',
|
2020-01-15 22:01:14 +01:00
|
|
|
'Reaction',
|
2020-01-25 21:52:37 +01:00
|
|
|
'Follow',
|
2020-01-14 23:26:39 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
const models = {};
|
|
|
|
modelNames.forEach(modelName => {
|
|
|
|
const filename = `./${modelName}.js`;
|
|
|
|
models[modelName] = require(path.resolve(__dirname, filename))(sequelize);
|
|
|
|
});
|
|
|
|
|
|
|
|
return require(path.resolve(__dirname, '../associations'))(models);
|
|
|
|
};
|