Skip to content

Instantly share code, notes, and snippets.

@lgandecki
Created June 21, 2019 09:28
Show Gist options
  • Save lgandecki/44825595b4dba82b531a6a23baa8815e to your computer and use it in GitHub Desktop.
Save lgandecki/44825595b4dba82b531a6a23baa8815e to your computer and use it in GitHub Desktop.
//Remember to add this require
const { estimateShipping } = require("./estimateShipping");
exports.resolvers = {
Product: {
__resolveReference(object) {
return {
...object,
...inventory.find(product => product.upc === object.upc)
};
},
// This is where we make changes
shippingEstimate: object =>
estimateShipping({
price: object.price,
weight: object.weight
})
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment