Commit Graph

21 Commits

Author SHA1 Message Date
Muhammad Labib Ramadhan
11306667d6 Refactored codes to not modify get-config-for-method.test.js, moved validationAssociations definition logic from get-config-for-method.js to crud.js, fixed README.md 2016-11-07 08:48:52 +07:00
Muhammad Labib Ramadhan
1977304287 Added README about association filtering 2016-11-04 14:24:01 +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
6a2290f064 Docs add docs for additional order option 2016-10-28 11:20:12 -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
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
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
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
Mahdi Dibaiee
bd18c57529 chore: put CircleCI badge in the same line as heading 2016-09-06 09:30:21 +04:30
Mahdi Dibaiee
81b704a395 chore: add CircleCI badge 2016-09-06 09:28:56 +04:30
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
Mahdi Dibaiee
d142e6c553 fix(options): take a name parameter, same as the name parameter used in hapi-sequelize, fixes #8 2016-07-13 10:03:00 +04:30
Mahdi Dibaiee
ca6298d6f4 chore(README, defaultConfig): add defaultConfig to README 2016-06-05 21:37:58 +04:30
Mahdi Dibaiee
11291f0e08 refactor: minimize repeated code by re-using parseInclude, parseWhere and getMethod
feat(include): ability to specify multiple includes, as an array
2016-03-10 10:48:30 +03:30
Mahdi Dibaiee
5e0eeccbac feat(associate): routes to associate objects with each other 2016-01-20 12:47:47 +03:30
Mahdi Dibaiee
cb2078b6cd chore(README): add scopes to "What do I get" section 2016-01-19 10:39:28 +03:30
Mahdi Dibaiee
6713ed0b0b chore(README): explain prefix with an example 2016-01-19 10:14:56 +03:30
Mahdi Dibaiee
52ad030d0d feat(associations): many-to-many associations
fix(associations): fix association queries, must use `include` instead of ForeignKey
fix(error): error decorator was missing await, which prevented it from catching errors
fix(error): console.error the error
refactor(crud): don't use `request.models[name]`, use the model directly
chore: README added
2016-01-19 10:03:29 +03:30