Skip to content

Conversation

@fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Jul 26, 2017

  • Generate many-to-one relationships in schema
  • Generate many-to-one relationship resolvers
  • Generate one-to-many relationships in schema
  • Generate one-to-many relationship resolvers
  • Add tests
  • Add documentation

Now the following query:

{
  Review(id: 0) {
    date
    rating
    comment
    Customer {
      first_name
      last_name
      Commands {
        date
        total
      }
    }
  }
}

Produces the following result:

{
  "data": {
    "Review": {
      "date": "2017-02-28T03:51:36.567Z",
      "rating": 5,
      "comment": "Nap wulniwgi gokzoij seejiud omiukoub cufcu bac wumu f...",
      "Customer": {
        "first_name": "Floyd",
        "last_name": "Sanchez",
        "Commands": [
          {
            "date": "2015-03-27T22:20:37.135Z",
            "total": 31.82
          },
          {
            "date": "2015-03-30T16:49:09.988Z",
            "total": 43.45
          }
        ]
      }
    }
  }
}

const relatedType = getRelatedType(fieldName);
schema = extendSchema(
schema,
parse(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find the way to define it programmatically.

@fzaninotto fzaninotto changed the title [WIP] Relationships [RFR] Relationships Jul 27, 2017
@fzaninotto
Copy link
Member Author

Switching to RFR

@Kmaschta Kmaschta merged commit 0237d43 into master Jul 27, 2017
@Kmaschta Kmaschta deleted the relationships branch July 27, 2017 13:31
@Kmaschta
Copy link
Contributor

Ah, what if you have a user_id but no User entity?

alexisjanvier pushed a commit that referenced this pull request Oct 10, 2019
[RFR] Fix security alert on diff package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants