Commit Graph

133 Commits

Author SHA1 Message Date
94e9870133 Fix(crud) 404 errors for destroy and destroyAll 2016-10-27 12:33:31 -07:00
0713f81301 Test add CRUD tests
boosting our test coverage
2016-10-27 12:33:02 -07:00
f49e4daf79 Test fix error checking in include tests #oops 2016-10-27 12:32:36 -07:00
57f95f8c95 Test(CI) setup code coverage
Also moves ava config to package.json
2016-10-26 18:10:32 -07:00
10d108878a Chore(deps) install codecov and nyc 2016-10-26 17:24:59 -07:00
eebf7b91f0 2.7.2 v2.7.2 2016-10-26 14:09:42 -07:00
a45a3ab317 Merge pull request #27 from mdibaiee/add-integration-tests
Add integration tests
2016-10-26 14:08:38 -07:00
7a8cd26dc8 Test add integration tests for ?include 2016-10-26 13:27:13 -07:00
80d0a74c82 Test add integration tests for route creation 2016-10-26 13:26:56 -07:00
863aa1d98b Test add fixtures and integration setup 2016-10-26 13:26:39 -07:00
90f72cb07a Fix(crud) models w/o associations validation 2016-10-26 13:26:15 -07:00
d3976fa44b Fix prefix should default to /, not ''
b/c `route` isn't a valid Hapi route, but `/route` is.
2016-10-26 13:25:27 -07:00
966b35164f Chore(deps) install dev deps for integration tests 2016-10-26 13:24:27 -07:00
548a6ecd98 2.7.1 v2.7.1 2016-10-26 11:43:53 -07:00
be993eda40 Merge pull request #26 from mdibaiee/fix-include
Fix(crud) include param lookup now works w/plurals
2016-10-26 11:42:15 -07:00
bcb7861061 Fix(crud) include param lookup now works w/plurals
Previously, {one,many}-to-many relationships with models would result in
`associationNames` that were plural. e.g. `Team` might have many
players and one location. The validation was expecting to see the plural
`Players` and the singular `Location` but Sequelize is expecting the
singular `Player` (`Location` worked fine). This meant that include
lookups would silently fail. This fixes the problem in a backward-
compatible way.

It continues to allow `include=Location` (capitalized) for backward-
compatibility. And now allows and actually does the lookup for
`include=players`, `include=player`, `include=Player`, `include=Players`
lookup relationships.
2016-10-26 11:19:36 -07:00
07176018b7 Fix(crud) include param can be a string or array 2016-10-26 10:59:02 -07:00
83eadf0929 Fix: don't build CRUD routes until ready
Previously, we were building the crud routes before we had run through
the association logic. This meant that routes could get created without
a complete list of associations available to it. This is slightly less
performant b/c we need to run through two loops, but ensures that the
full association data is available to all routes.
2016-10-26 10:57:54 -07:00
e318948fe4 2.7.0 v2.7.0 2016-10-21 11:11:24 -07:00
d35b616a13 Merge pull request #25 from mdibaiee/add-filters
Feat add support of limit, offset, order
2016-10-21 11:10:35 -07:00
8966d7b287 Feat add support of limit, offset, order
Allows passing these as query params to list and scope methods.
2016-10-21 11:07:27 -07:00
5923f0dbcb Test(crud) ensure list doesn't error 2016-10-20 17:20:22 -07:00
adb1d71984 Chore(deps) update patches and minors 2016-10-20 17:20:22 -07:00
3c516aa604 Chore gitignore mac junk files 2016-09-28 21:16:38 -07:00
ddc6fcceb8 Chore (build) set sourcemaps to inline
This ensures that node can read the sourcemaps and provide useful
stacktraces
2016-09-28 21:16:17 -07:00
f403e214a9 Docs show how to interact with hapi hooks
Fixes #3
2016-09-19 21:47:12 -07:00
71e6390282 Docs: add "modify the response format" section 2016-09-13 19:44:36 -07:00
a720e30a85 2.6.2 v2.6.2 2016-09-08 13:27:20 -07:00
518c4a4226 2.6.1 2016-09-08 13:27:10 -07:00
469aaec66f Merge pull request #23 from mdibaiee/fix-joi-concat
Fix (validation) use joi's concat
2016-09-08 13:26:50 -07:00
8ee5661252 Test: only run src test files #oops 2016-09-08 13:24:08 -07:00
c59943a717 Fix (validation) use joi's concat
It turns out defaultsDeep doesn't ever correctly combine Joi objects.
So, the only option is to use Joi's concat method to combine Joi
schemas. This complicates `getConfigForMethod`, but simplifies actual
route creation.

I ran into this because I'm setting up [lout](https://github.com/hapijs/lout)
on a server, and it requires properly formatted Joi schemas. This leads
me to believe there was something already wrong and Lout just exposed
the problem.
2016-09-08 13:20:50 -07:00
8cdfc5858d Merge pull request #24 from mdibaiee/use-json
Fix toJSON responses
2016-09-08 11:33:47 -07:00
4e078f5ba5 Fix toJSON responses
This is a non-obvious one. Hapi is happy to convert raw sequelize
instances to proper JSON (likely because Sequelize does nice things),
but we do that, we can't use `config.response.schema`, because it
receives the full sequelize instance instead of JSON.

This is a patch release.
2016-09-07 21:06:34 -07:00
85111c7dc8 2.6.0 v2.6.0 2016-09-06 11:30:22 -07:00
196999a4c5 Merge pull request #20 from Getable/error-on-invalid-where
Validate query and payload
2016-09-06 11:29:40 -07:00
3e9f024dcf Test: now testing get-config-for-method 2016-09-06 11:25:03 -07:00
4c9ae36c5c Refactor: move get-config-for-method to a file 2016-09-06 11:24:41 -07:00
4558ad1327 Chore (deps) update minors and patches
Not strictly necessary, but kinda nice to prove we're up-to-date
2016-09-06 09:25:02 -07:00
edccfb2316 Chore (deps) update Joi 7 → 9
Shouldn't impact us
2016-09-06 07:28:43 -07:00
0d8ab9f02e Chore (deps) update boom (major)
They just removed a method we don't use.
2016-09-06 07:28:43 -07:00
f062e2b37f Fix (validation) params is a plain object
If we use a Joi object here, we can't use `defaultsDeep` to extend b/c
the joi prototype won't extend cleanly. We'd need to use joi's `contact`
method, but that gets really complicated and error prone. So, just use
a plain object which is more correct anyway.

http://hapijs.com/tutorials/validation
2016-09-06 07:28:43 -07:00
69221ea331 Feat query & payload now validated 2016-09-06 07:28:43 -07:00
f33c8da55d Fix (CRUD update) validate id 2016-09-06 07:28:43 -07:00
833df49173 Chore add comments for config creation 2016-09-06 07:28:43 -07:00
32a539c3d9 Fix (crud) update: findOnefindById
b/c `findById` uses an index to lookup, and should be fast.
2016-09-06 07:28:43 -07:00
b35bd23c91 Fix: prefer user's config before our own 2016-09-06 07:28:43 -07:00
b4ea8c5b8e Docs: add more details for include and where 2016-09-06 07:28:43 -07:00
85cd2823da Docs: #cleanup and style fixes 2016-09-06 07:28:43 -07:00
e0132c2cae Fix: handle all parseInclude errors 2016-09-06 07:28:43 -07:00