Exemple #1
0
      resolve: artwork => {
        if (
          artwork.domestic_shipping_fee_cents == null &&
          artwork.international_shipping_fee_cents == null
        )
          return "Shipping, tax, and service quoted by seller"
        if (
          artwork.domestic_shipping_fee_cents === 0 &&
          artwork.international_shipping_fee_cents === 0
        )
          return "Free shipping worldwide"
        var domesticShipping = amount(
          ({ domestic_shipping_fee_cents }) => domestic_shipping_fee_cents
        ).resolve(artwork, { precision: 0 })
        var internationalShipping = amount(
          ({ international_shipping_fee_cents }) =>
            international_shipping_fee_cents
        ).resolve(artwork, { precision: 0 })

        if (domesticShipping && !internationalShipping)
          return "Shipping: " + domesticShipping + " Continental US only"
        return (
          "Shipping: " +
          domesticShipping +
          " Continental US, " +
          internationalShipping +
          " rest of the world"
        )
      },
Exemple #2
0
      type: GraphQLInt,
    },
    from: {
      type: GraphQLInt,
    },
    to: {
      type: GraphQLInt,
    },
  },
})

const BuyersPremium = new GraphQLObjectType({
  name: "BuyersPremium",
  fields: {
    ...GravityIDFields,
    amount: amount(({ cents }) => cents),
    cents: {
      type: GraphQLInt,
      resolve: ({ cents }) => cents,
    },
    percent: {
      type: GraphQLFloat,
    },
  },
})

const saleArtworkConnection = connectionDefinitions({
  nodeType: SaleArtwork.type,
}).connectionType

const SaleType = new GraphQLObjectType({