Created
September 24, 2018 07:59
-
-
Save webchi/f56ae91876e83651c7180e45c3c96a12 to your computer and use it in GitHub Desktop.
Graphql resolvers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Miner { | |
name: String! | |
foundBlocks(limit: Int): [FoundBlock] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Miner.associate = (models) => { | |
Miner.FoundBlocks = Miner.hasMany(models.Block); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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