Skip to content
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: relationships #44

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "airbnb-base",
"parser": "@babel/eslint-parser",
"env": {
"mocha": true,
"browser": true,
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,26 @@ You can change this key `id` to any string.

Default: `id`

### Relationships Map

If you need to work with relationships you will need to declare these in order for the data provider to be able to serialize your data.

For example: say you're working with `projects` and those projects have an `owner` and `collaborators`. When you create those `projects` the data provider will have no way to know those related objects are `users` when serializing so we'll need to specify the `owner` and each object found within the `collaborators` array are to be serialized with `type` equal to `users`.

```js
{
relationshipsMap: {
projects: {
owner: 'users', // project.owner is serialized with { type: 'users' }
collaborators: 'users' // project.collaborators is serialized with { type: 'users' }
}
}
}
```

## Contributors
* [TMiguelT](https://github.com/TMiguelT)
* [hootbah](https://github.com/hootbah)
* [770studio](https://github.com/770studio)
* [foxeg](https://github.com/foxeg)
* [mrnkr](https://github.com/mrnkr)
Loading