Joey Baker and GitHub
facde8d542
Merge pull request #39 from rithalnz/patch-1
...
Create LICENSE
2021-03-13 11:35:24 -08:00
Joey Baker
5ba9d7d261
2.9.1
2016-11-01 19:10:04 -07:00
Joey Baker and GitHub
07837ef36c
Merge pull request #33 from mdibaiee/add-limit-offset-tests
...
Add integration tests for limit/offset
2016-11-01 19:09:45 -07:00
Joey Baker
25501bbb10
Test add integration tests for limit/offset
...
#28
2016-11-01 17:39:35 -07:00
Joey Baker
a335471f02
Fix(crud/list) 404 on no results
2016-11-01 17:39:16 -07:00
Joey Baker
ce26814f74
Test add a returnsAll scope to player fixture
2016-11-01 17:38:55 -07:00
Joey Baker
d1fc6d46e8
2.9.0
2016-10-31 14:24:12 -07:00
Joey Baker and GitHub
4e94c7f825
Merge pull request #32 from mdibaiee/more-order-integration
...
Feat ordering by associated models now works
2016-10-31 14:23:43 -07:00
Joey Baker
c289fb2ed4
Feat ordering by associated models now works
...
It's now possible to order by associated models. This technically might
have worked before b/c we were parsing JSON sent to `order`, but I'm
pretty sure it wouldn't actually work b/c we never grabbed the actual
model to associate by. Regardless, this actually enables things and adds
tests to prove it.
Note: there's a sequelize bug that's poorly reported but definitely
known where `order` with associated models can fail because the sql
generated doesn't include a join. So, I added docs noting that and a
`test.failing` so that we'll be notified when that bug is fixed and can
remove the note.
2016-10-31 12:48:34 -07:00
Joey Baker
e1b851f932
Test: add a second mock team
...
So that we can test complex sorts
2016-10-31 12:41:34 -07:00
Joey Baker
34e37217f1
2.8.0
2016-10-28 11:28:23 -07:00
Joey Baker and GitHub
6a80149916
Merge pull request #31 from mdibaiee/code-coverage
...
Add more integration tests
2016-10-28 11:28:06 -07:00
Joey Baker
cb6ea51836
Test add integration tests for scope
2016-10-28 11:22:52 -07:00
Joey Baker
5aec1242db
Test add integration tests for ordering lists
2016-10-28 11:22:38 -07:00
Joey Baker
8fb3f2e849
Fix(crud) actually enable multiple orders
...
This was supposed to work, but adding integration tests I realized it
didn't. #oops
2016-10-28 11:22:05 -07:00
Joey Baker
11e6ff596c
Fix(crud) scope now 404s on no results
2016-10-28 11:20:59 -07:00
Joey Baker
6a2290f064
Docs add docs for additional order option
2016-10-28 11:20:12 -07:00
Joey Baker
1daa68e03e
Fix(crud) destroyScope sends 404 when not found
2016-10-27 21:03:57 -07:00
Joey Baker
01081db7a3
Test add destroyScope tests
2016-10-27 21:03:32 -07:00
Joey Baker
3b962ce4d8
2.7.3
2016-10-27 13:20:46 -07:00
Joey Baker and GitHub
f638680e29
Merge pull request #30 from mdibaiee/code-coverage
...
Add integration tests
2016-10-27 13:20:18 -07:00
Joey Baker
94e9870133
Fix(crud) 404 errors for destroy and destroyAll
2016-10-27 12:33:31 -07:00
Joey Baker
0713f81301
Test add CRUD tests
...
boosting our test coverage
2016-10-27 12:33:02 -07:00
Joey Baker
f49e4daf79
Test fix error checking in include tests #oops
2016-10-27 12:32:36 -07:00
Joey Baker and GitHub
087e64607c
Merge pull request #29 from mdibaiee/code-coverage
...
Add code coverage
2016-10-26 18:14:37 -07:00
Joey Baker
57f95f8c95
Test(CI) setup code coverage
...
Also moves ava config to package.json
2016-10-26 18:10:32 -07:00
Joey Baker
10d108878a
Chore(deps) install codecov and nyc
2016-10-26 17:24:59 -07:00
Joey Baker
eebf7b91f0
2.7.2
2016-10-26 14:09:42 -07:00
Joey Baker and GitHub
a45a3ab317
Merge pull request #27 from mdibaiee/add-integration-tests
...
Add integration tests
2016-10-26 14:08:38 -07:00
Joey Baker
7a8cd26dc8
Test add integration tests for ?include
2016-10-26 13:27:13 -07:00
Joey Baker
80d0a74c82
Test add integration tests for route creation
2016-10-26 13:26:56 -07:00
Joey Baker
863aa1d98b
Test add fixtures and integration setup
2016-10-26 13:26:39 -07:00
Joey Baker
90f72cb07a
Fix(crud) models w/o associations validation
2016-10-26 13:26:15 -07:00
Joey Baker
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
Joey Baker
966b35164f
Chore(deps) install dev deps for integration tests
2016-10-26 13:24:27 -07:00
Joey Baker
548a6ecd98
2.7.1
2016-10-26 11:43:53 -07:00
Joey Baker and GitHub
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
Joey Baker
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
Joey Baker
07176018b7
Fix(crud) include param can be a string or array
2016-10-26 10:59:02 -07:00
Joey Baker
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
Joey Baker
e318948fe4
2.7.0
2016-10-21 11:11:24 -07:00
Joey Baker and GitHub
d35b616a13
Merge pull request #25 from mdibaiee/add-filters
...
Feat add support of limit, offset, order
2016-10-21 11:10:35 -07:00
Joey Baker
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
Joey Baker
5923f0dbcb
Test(crud) ensure list doesn't error
2016-10-20 17:20:22 -07:00
Joey Baker
adb1d71984
Chore(deps) update patches and minors
2016-10-20 17:20:22 -07:00
Joey Baker
3c516aa604
Chore gitignore mac junk files
2016-09-28 21:16:38 -07:00
Joey Baker
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
Joey Baker
f403e214a9
Docs show how to interact with hapi hooks
...
Fixes #3
2016-09-19 21:47:12 -07:00
Joey Baker
71e6390282
Docs: add "modify the response format" section
2016-09-13 19:44:36 -07:00
Joey Baker
a720e30a85
2.6.2
2016-09-08 13:27:20 -07:00
Joey Baker
518c4a4226
2.6.1
2016-09-08 13:27:10 -07:00
Joey Baker and GitHub
469aaec66f
Merge pull request #23 from mdibaiee/fix-joi-concat
...
Fix (validation) use joi's concat
2016-09-08 13:26:50 -07:00
Joey Baker
8ee5661252
Test: only run src test files #oops
2016-09-08 13:24:08 -07:00
Joey Baker
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
Joey Baker and GitHub
8cdfc5858d
Merge pull request #24 from mdibaiee/use-json
...
Fix toJSON responses
2016-09-08 11:33:47 -07:00
Joey Baker
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
Joey Baker
85111c7dc8
2.6.0
2016-09-06 11:30:22 -07:00
Joey Baker and GitHub
196999a4c5
Merge pull request #20 from Getable/error-on-invalid-where
...
Validate query and payload
2016-09-06 11:29:40 -07:00
Joey Baker
3e9f024dcf
Test: now testing get-config-for-method
2016-09-06 11:25:03 -07:00
Joey Baker
4c9ae36c5c
Refactor: move get-config-for-method to a file
2016-09-06 11:24:41 -07:00
Joey Baker
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
Joey Baker
edccfb2316
Chore (deps) update Joi 7 → 9
...
Shouldn't impact us
2016-09-06 07:28:43 -07:00
Joey Baker
0d8ab9f02e
Chore (deps) update boom (major)
...
They just removed a method we don't use.
2016-09-06 07:28:43 -07:00
Joey Baker
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
Joey Baker
69221ea331
Feat query & payload now validated
2016-09-06 07:28:43 -07:00
Joey Baker
f33c8da55d
Fix (CRUD update) validate id
2016-09-06 07:28:43 -07:00
Joey Baker
833df49173
Chore add comments for config creation
2016-09-06 07:28:43 -07:00
Joey Baker
32a539c3d9
Fix (crud) update: findOne → findById
...
b/c `findById` uses an index to lookup, and should be fast.
2016-09-06 07:28:43 -07:00
Joey Baker
b35bd23c91
Fix: prefer user's config before our own
2016-09-06 07:28:43 -07:00
Joey Baker
b4ea8c5b8e
Docs: add more details for include and where
2016-09-06 07:28:43 -07:00
Joey Baker
85cd2823da
Docs: #cleanup and style fixes
2016-09-06 07:28:43 -07:00
Joey Baker
e0132c2cae
Fix: handle all parseInclude errors
2016-09-06 07:28:43 -07:00
Joey Baker
03755f94c5
Test (CI) configure circle
2016-09-05 17:37:50 -07:00
Joey Baker
7cecd7fb40
Test (list) add initial list tests
2016-09-05 17:12:13 -07:00
Joey Baker
7b757fcc50
Fix (crud) if no prefix, things still work
2016-09-05 17:11:42 -07:00
Joey Baker
de0685c8bb
Chore: install and configure AVA
2016-09-05 17:10:58 -07:00
Joey Baker
f2f613b35b
Fix: boom error on invalid include
...
Sends a 501 `notImplemented` error when `parseInclude` can't find models
to include.
2016-09-05 17:08:09 -07:00
Joey Baker
38ccb3adf6
Chore (deps) update eslint (major)
...
Breaking changes shouldn't affect us
2016-09-05 15:43:48 -07:00
Joey Baker
506d42f39a
2.5.4
2016-09-05 12:30:15 -07:00
Joey Baker and GitHub
3dfa72ddee
Merge pull request #21 from Getable/better-error
...
Fix a bug in error parsing
2016-09-05 12:25:14 -07:00
Joey Baker
bab2e90cbb
Feat (error) parse PG 42* errors
2016-09-04 17:28:16 -07:00
Joey Baker
da6b3ce963
Feat (error) include hint on PG errors
...
Provides useful info!
2016-09-04 17:28:09 -07:00
Joey Baker
b032be20d1
Fix (error) always reply with an error #oops
...
We had a case where reply would never be called. This could case a
server hang.
2016-09-04 17:28:01 -07:00
Joey Baker
a9fa790ae9
Fix (deps): install babel-polyfill as optionalDep
...
We only require it if something else hasn't so this is a optionalDep.
2016-08-29 17:08:44 -07:00
Joey Baker
ce6f1fedde
Fix: bad merge in error.js
2016-08-28 09:57:23 -07:00
Joey Baker
db86507ef9
Fix: correct babel-polyfill version
...
This installs the babel-polyfill for babel 6. #oops
2016-08-28 09:56:46 -07:00
Joey Baker
0e9cd935b9
Add: parse Sequelize errors
...
This adds intelligence around sequelize errors to parse out the correct
error status code and ensure it's always formatted as a Boom error.
2016-08-25 21:28:23 -07:00
Joey Baker
6d289d6d78
Add: Better errors
...
Now looks at the error that comes back from sequelize and uses boom to
format the error in a more friendly way. This should yield useful error
messages instead of generic 500s.
2016-08-03 14:42:20 -07:00
Joey Baker
79b9fc1242
Change: permissions must always be an array
...
This allows us to set different configs per model. I should have thought
of this usecase when I first did permissions.
2016-07-22 11:50:08 -07:00
Joey Baker
f95f411a65
Add: permissions
...
It's now possible to limit the models rest routes are created for. This
is done via a `models` option that can be simple to complex. The readme
has been updated to reflect this.
2016-07-22 10:14:17 -07:00
Joey Baker
0416986896
Build: rm extraneous babel dep #oops
2016-07-22 09:52:21 -07:00
Joey Baker
2ea6c2e3a8
Fix: include option api correction
...
AFAIK, hapi-sequelize doesn't have a `request.models`, but it does have
a `request.getDb()` method that has `models` on it. This calls that
method to get the related models, but allows `request.models` to keep
working for backward compatibility.
2016-07-08 15:28:33 -07:00
Joey Baker
fee846eb4a
Fix: PUT requires a payload to work
2016-07-05 18:34:56 -07:00
Joey Baker
e7bc048a46
Internal: upgrade to babel6
...
Upgrades to babel 6. The major win (aside from some minor
performance gains), is that this module can now be `npm link`ed into a
babel 6 code base.
2016-07-05 14:47:44 -07:00
Joey Baker
0698a8a3ad
Fix: crud: GET id's can be strings or numbers
2016-06-29 21:30:27 -07:00
Joey Baker
3f419284be
Fix: Reply with 404 when required
2016-06-29 21:28:56 -07:00
Joey Baker
6958c49622
Build: install boom
2016-06-29 21:27:44 -07:00