Skip to content

Include param defined in the adapter  #10

Open
@bmac

Description

@bmac

@bobholt @tkellen @cowboy @leobalter What is your reaction to the idea of defining the include parameter on the adapter? I was thinking it would end up looking something like this.

// app/adapters/post.js

import EndpointsAdapter from "ember-data-endpoints/adapter";
export default EndpointsAdapter.extend({
  queryParams: {
    include: ['author', 'comments', 'comments.author'].join(',')
  }
});

Then any time you would need to do a get GET request the adapter's queryParams object would be serialized into the url. For example store.find('post') would request GET /posts?include=author,comments,comments.author and store.find('post', 1) would request GET /posts/1?include=author,comments,comments.author.

I think in the cases where doing a store.find('post', {include: 'foo'}) the include: 'foo' would take priority over the the include defined on the queryParams object.

Open question. Should the queryParams be included in the url for non get requests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions