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

Reference with multiple node types #50

Merged
merged 11 commits into from Dec 10, 2018
Merged

Conversation

hjvedvik
Copy link
Member

@hjvedvik hjvedvik commented Nov 19, 2018

This PR makes it possible to reference multiple node types. Also adds sortBy, order, skip and limit arguments for references which returns a list of nodes.

Store API

books.addNode({
  title: 'Title',
  fields: {
    shops: [
      { typeName: 'PhysicalShop', id: '1' },
      { typeName: 'OnlineShop', id: '1' }
    ]
  }
})

Example query

query Book ($id: String!) {
  book (id: $id) {
    title
    shops (sortBy: "title", limit: 5) {
      __typename
      ...on NodeInterface {
        title
      }
      ...on PhysicalShop {
        address
      }
      ...on OnlineShop {
        website
      }
    }
  }
}

@hjvedvik hjvedvik merged commit 185297f into master Dec 10, 2018
@hjvedvik hjvedvik deleted the feat/refs-with-multiple-types branch February 14, 2019 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant