Skip to content

Instantly share code, notes, and snippets.

@jamesplease
Created April 28, 2018 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesplease/05517540bea4b6ff0c37cf1703190459 to your computer and use it in GitHub Desktop.
Save jamesplease/05517540bea4b6ff0c37cf1703190459 to your computer and use it in GitHub Desktop.
{
// These are the resource types in this relationship.
// In this case, both sides of the relationship are people.
resourceTypes: ['people'],
relationshipSchema: {
fields: {
father: {
resourceType: 'people',
},
son: {
resourceType: 'author'
},
},
// this is necessary to define what
// one-to-one and one-to-many mean
// this is where the relationship was defined on the
// schema
host: 'people',
// one-to-one, one-to-many, many-to-many
type: 'one-to-many'
}
// Using this and the schema, we can piece the relationship back together
values: {
father: 1,
son: 5
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment