fix(crud): should ignore JoinTable models while creating the routes -

solves #37
This commit is contained in:
Mahdi Dibaiee 2017-02-04 22:11:58 +03:30
parent 5ba9d7d261
commit 85b52fd5ab
2 changed files with 2 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{
"name": "hapi-sequelize-crud",
"version": "2.9.1",
"version": "2.9.2",
"description": "Hapi plugin that automatically generates RESTful API for CRUD",
"main": "build/index.js",
"config": {

View File

@ -37,7 +37,7 @@ const register = (server, options = {}, next) => {
// Join tables
if (model.options.name.singular !== model.name) continue;
crud(server, model, options);
for (const key of Object.keys(model.associations)) {
const association = model.associations[key];
@ -93,13 +93,6 @@ const register = (server, options = {}, next) => {
}
}
// build the methods for each model now that we've defined all the
// associations
Object.keys(models).forEach((modelName) => {
const model = models[modelName];
crud(server, model, options);
});
next();
};