Skip to content

Instantly share code, notes, and snippets.

@webchi
Created September 24, 2018 07:59
Show Gist options
  • Save webchi/f56ae91876e83651c7180e45c3c96a12 to your computer and use it in GitHub Desktop.
Save webchi/f56ae91876e83651c7180e45c3c96a12 to your computer and use it in GitHub Desktop.
Graphql resolvers
type Miner {
name: String!
foundBlocks(limit: Int): [FoundBlock]
}
Miner.associate = (models) => {
Miner.FoundBlocks = Miner.hasMany(models.Block);
};
Query: {
miners: resolver(models.Miner),
},
Miner: {
foundBlocks: resolver(models.Miner.FoundBlocks),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment