-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(model): add support to nested keys for relations #127
feat(model): add support to nested keys for relations #127
Conversation
@JoaoPedroAS51 Many thanks 👍 |
@JoaoPedroAS51 muito bom! Você poderia me mandar um DM @robsontenorio no Twitter? |
@robsontenorio Vlw! :) |
@robsontenorio Sorry for asking, but is this going to be merged/planned to be supported? :) |
@francoism90 Yes, it will be merged soon. :) |
* docs: add nuxt docs * docs: add introduction, installation, configuration, usage and nuxt example * docs: add api docs * docs: update configuration and usage * ci: add nodejs ci * ci: fix setup node version * chore(eslint): add .eslintignore * chore(scripts): add "lint" script * chore(scripts): add "test-watch" script * ci(docs): update deploy action * ci: fix docs and publish * ci: fix docs working directory * docs: fix url * docs: fix base url * ci: fix docs action * docs: fix pages position * chore(script): add `--coverage` flag to `test` script * ci(publish): add step to upload coverage to codecov * chore(scripts): remove "prepare" script * fix(model): add null check in `isValidId` (robsontenorio#115) When an entity is being saved, nulls are considered as existing entities, so it tries to update and not insert. * feat(model): handle 'data' wrapped responses for create and update (robsontenorio#109) Laravel allows data wrapping for all responses, so create and update requests should support this if it is done. * feat(model): add support to nested keys for relations (robsontenorio#127) * feat(utils): add utilities `getProp` and `setProp` * feat(model): add support to nested keys for relations * test(model): test support of nested keys for relations * test(utils): test utilities * chore: update readme * chore: bump node-fetch from 2.6.0 to 2.6.1 (robsontenorio#124) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](node-fetch/node-fetch@v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: update configuration and api options * docs: update api docs * docs(model options): update docs * docs(query builder methods): update docs * docs(model options): add `primaryKey` default value * docs(model options): fix typo * docs(example): rename file of nuxt example * docs: remove usage section * docs: add building query section * docs: fix typo * docs: add "including relationships" * docs: add helpers * docs(operations): fix typo * docs(api): update query builder methods * docs: fix response of section "including relationships" * docs: add "appending attributes" * docs: add "selecting fields" and update other docs * docs: add "paginating" and add missing colons. * docs: add api reference to "selecting fields" section * docs: update "paginating" section * docs: add "applying parameters" * docs: add "calling a custom resource" * docs: add api reference of `params` and `custom` * docs: add "composing without request" * docs: remove unnecessary responses * docs: update "calling a custom resource" * docs: fix crud order * docs: fix create request * docs: update example of delete operation * docs: add "mixing everything up" * docs: fix append example * docs: add "performing operations" * docs: update `select` and `custom` * docs: update model options * docs: update configuration * docs: add vue example Co-authored-by: Guilherme Zanini <gui_rz@hotmail.com> Co-authored-by: Francis Adu-Gyamfi <francis.adu-gyamfi@topgolf.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* docs: add nuxt docs * docs: add introduction, installation, configuration, usage and nuxt example * docs: add api docs * docs: update configuration and usage * ci: add nodejs ci * ci: fix setup node version * chore(eslint): add .eslintignore * chore(scripts): add "lint" script * chore(scripts): add "test-watch" script * ci(docs): update deploy action * ci: fix docs and publish * ci: fix docs working directory * docs: fix url * docs: fix base url * ci: fix docs action * docs: fix pages position * chore(script): add `--coverage` flag to `test` script * ci(publish): add step to upload coverage to codecov * chore(scripts): remove "prepare" script * fix(model): add null check in `isValidId` (robsontenorio#115) When an entity is being saved, nulls are considered as existing entities, so it tries to update and not insert. * feat(model): handle 'data' wrapped responses for create and update (robsontenorio#109) Laravel allows data wrapping for all responses, so create and update requests should support this if it is done. * feat(model): add support to nested keys for relations (robsontenorio#127) * feat(utils): add utilities `getProp` and `setProp` * feat(model): add support to nested keys for relations * test(model): test support of nested keys for relations * test(utils): test utilities * chore: update readme * chore: bump node-fetch from 2.6.0 to 2.6.1 (robsontenorio#124) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](node-fetch/node-fetch@v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: update configuration and api options * docs: update api docs * docs(model options): update docs * docs(query builder methods): update docs * docs(model options): add `primaryKey` default value * docs(model options): fix typo * docs(example): rename file of nuxt example * docs: remove usage section * docs: add building query section * chore: update package.json * chore: update README.md * docs: fix typo * docs: add "including relationships" * docs: add helpers * docs(operations): fix typo * docs(api): update query builder methods * docs: fix response of section "including relationships" * docs: add "appending attributes" * docs: add "selecting fields" and update other docs * fix(utils): accept array of strings in param `propName` of `setProp` * test(utils): add tests for `setProp` * fix(utils): fix `getProp` * fix(utils): accept array of strings in param `propName` of `getProp` * test(utils): add tests for `getProp` * refactor(utils): update jsdocs of `getProp` and `setProp` * refactor(test): remove semicolon * docs: add "paginating" and add missing colons. * docs: add api reference to "selecting fields" section * docs: update "paginating" section * docs: add "applying parameters" * docs: add "calling a custom resource" * docs: add api reference of `params` and `custom` * docs: add "composing without request" * docs: remove unnecessary responses * docs: update "calling a custom resource" * docs: fix crud order * docs: fix create request * docs: update example of delete operation * docs: add "mixing everything up" * docs: fix append example * docs: add "performing operations" * docs: update `select` and `custom` * docs: update model options * docs: update configuration * docs: add vue example * docs: update "needless parent request"
* docs: add nuxt docs * docs: add introduction, installation, configuration, usage and nuxt example * docs: add api docs * docs: update configuration and usage * ci: add nodejs ci * ci: fix setup node version * chore(eslint): add .eslintignore * chore(scripts): add "lint" script * chore(scripts): add "test-watch" script * ci(docs): update deploy action * ci: fix docs and publish * ci: fix docs working directory * docs: fix url * docs: fix base url * ci: fix docs action * docs: fix pages position * chore(script): add `--coverage` flag to `test` script * ci(publish): add step to upload coverage to codecov * chore(scripts): remove "prepare" script * fix(model): add null check in `isValidId` (robsontenorio#115) When an entity is being saved, nulls are considered as existing entities, so it tries to update and not insert. * feat(model): handle 'data' wrapped responses for create and update (robsontenorio#109) Laravel allows data wrapping for all responses, so create and update requests should support this if it is done. * feat(model): add support to nested keys for relations (robsontenorio#127) * feat(utils): add utilities `getProp` and `setProp` * feat(model): add support to nested keys for relations * test(model): test support of nested keys for relations * test(utils): test utilities * chore: update readme * chore: bump node-fetch from 2.6.0 to 2.6.1 (robsontenorio#124) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](node-fetch/node-fetch@v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: update configuration and api options * docs: update api docs * docs(model options): update docs * docs(query builder methods): update docs * docs(model options): add `primaryKey` default value * docs(model options): fix typo * docs(example): rename file of nuxt example * docs: remove usage section * docs: add building query section * chore: update package.json * chore: update README.md * docs: fix typo * docs: add "including relationships" * docs: add helpers * docs(operations): fix typo * docs(api): update query builder methods * docs: fix response of section "including relationships" * docs: add "appending attributes" * docs: add "selecting fields" and update other docs * fix(utils): accept array of strings in param `propName` of `setProp` * test(utils): add tests for `setProp` * fix(utils): fix `getProp` * fix(utils): accept array of strings in param `propName` of `getProp` * test(utils): add tests for `getProp` * refactor(utils): update jsdocs of `getProp` and `setProp` * refactor(test): remove semicolon * docs: add "paginating" and add missing colons. * docs: add api reference to "selecting fields" section * docs: update "paginating" section * docs: add "applying parameters" * docs: add "calling a custom resource" * docs: add api reference of `params` and `custom` * docs: add "composing without request" * docs: remove unnecessary responses * docs: update "calling a custom resource" * docs: fix crud order * docs: fix create request * docs: update example of delete operation * docs: add "mixing everything up" * docs: fix append example * docs: add "performing operations" * docs: update `select` and `custom` * docs: update model options * docs: update configuration * docs: add vue example * docs: update "needless parent request" * docs: remove helpers
@robsontenorio @JoaoPedroAS51 It seems this is missing in the docs? :) |
@francoism90 Thanks for report. I'll update the docs :) |
As requested by @francoism90, this PR add support for nested keys e.g.
relationships.tags
Usage
You can apply a model instance to a nested object by setting the key and the model in
relations
method.If the backend responds with:
We just need to set
relationships.tags
to Tag model:/models/Post.js