-
-
Save benjie/68f55fa1bcc07e1cd7a8f49d423f1416 to your computer and use it in GitHub Desktop.
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
const { makeExtendSchemaPlugin, gql } = require("graphile-utils"); | |
const { convertUsdToAud } = require("ficticious-npm-library"); | |
const MyForeignExchangePlugin = makeExtendSchemaPlugin(build => { | |
return { | |
typeDefs: gql` | |
extend type Product { | |
priceInAuCents: Int! | |
@requires(columns: ["price_in_us_cents"]) | |
} | |
`, | |
resolvers: { | |
Product: { | |
priceInAuCents: async product => { | |
const { priceInUsCents } = product; | |
return await convertUsdToAud(priceInUsCents); | |
}, | |
}, | |
}, | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment