Compare commits

...

4 Commits

Author SHA1 Message Date
Joey Baker
facde8d542
Merge pull request #39 from rithalnz/patch-1
Create LICENSE
2021-03-13 11:35:24 -08:00
rithalnz
0cbc28ef90
Create LICENSE
Added MIT License
2021-03-10 12:49:07 -08:00
Mahdi Dibaiee
a6590a9650 fix(crud): see 83eadf0929 and #37 2017-02-04 22:18:22 +03:30
Mahdi Dibaiee
85b52fd5ab fix(crud): should ignore JoinTable models while creating the routes -
solves #37
2017-02-04 22:11:58 +03:30
3 changed files with 27 additions and 3 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2021 The hapi-sequelize-crud Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

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

View File

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