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

Parent relationship not working as in HTTP Adapter #23

Open
JoaoMosmann opened this issue Apr 5, 2016 · 3 comments
Open

Parent relationship not working as in HTTP Adapter #23

JoaoMosmann opened this issue Apr 5, 2016 · 3 comments

Comments

@JoaoMosmann
Copy link

I'm not sure if it's on purpose. But I thought that by defining a resource as belonging to another resource using the property parent: true It would behave as in the HTTP Adapter which mounts the endpoint relative to its parent.

If this is a planned feature that was forgotten, I can do a PR. If not, why ?

e.g:

var Comment = store.defineResource({
  name: 'comment',
  relations: {
    belongsTo: {
      post: {
        parent: true,
        localKey: 'postId',
        localField: 'post'
      }
    }
  }
});

Comment.find(5, { params: { postId: 4 } }); // GET /post/4/comment/5
@jmdobry
Copy link
Member

jmdobry commented Apr 6, 2016

I only ever imagined parent: true to be something the http adapter uses.

@JoaoMosmann
Copy link
Author

I believe it would be a good feature for this adapter. Because the Firebase endpoints follows the REST pattern as the urls used in the HttpAdapter.

However, Firebase doesn't recommend to do a nested data structure. But I think it should be up to the developer.

@jmdobry
Copy link
Member

jmdobry commented Sep 20, 2016

Firebase doesn't recommend to do a nested data structure

I agree with that, as your Firebase database is just a large JSON tree, nested data requires that the client download inordinate amounts of data.

But I think it should be up to the developer.

Right. Would you be interested in adding support for this to js-data-firebase? I imagine you already have some code to handle this in your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants