Skip to content

Instantly share code, notes, and snippets.

@benjie
Created June 12, 2020 09:34
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 benjie/68f55fa1bcc07e1cd7a8f49d423f1416 to your computer and use it in GitHub Desktop.
Save benjie/68f55fa1bcc07e1cd7a8f49d423f1416 to your computer and use it in GitHub Desktop.
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