patrick_madx
03/29/2018, 12:59 PMtype Quotation {
id: ID! @unique
costs: [Cost!]!
prices: [Float!]! // Sum of costs
}
type Cost {
...
values: [Float!]!
currency: String!
}
I'd expect to have my own resolver, so this works:
export const Quotation = {
prices: async (parent, args, ctx: Context, info) => {
return [1,2,3]
},
}
Yet how do I rerieve the costs? I don't have a `quotation id`/`cost ids` somewhere...patrick_madx
03/29/2018, 1:00 PMpatrick_madx
03/29/2018, 1:40 PMquotations {
id
prices
}
patrick_madx
03/29/2018, 1:43 PMpatrick_madx
03/29/2018, 1:43 PMpatrick_madx
03/29/2018, 1:43 PMVakrim
03/29/2018, 2:37 PMpatrick_madx
03/29/2018, 2:41 PMpatrick_madx
03/29/2018, 2:41 PMpatrick_madx
03/29/2018, 3:06 PMpatrick_madx
03/29/2018, 3:07 PMfragment NumRatings on Place { id }
patrick_madx
03/29/2018, 3:07 PMpatrick_madx
03/29/2018, 3:08 PMpatrick_madx
03/29/2018, 3:08 PMexport const Quotation = {
prices: {
fragment: `???`,
resolve: async (parent, args, ctx: Context, info) => {
console.log(parent)
return null
}
}
}
patrick_madx
03/29/2018, 3:31 PMpatrick_madx
03/29/2018, 3:35 PMnilan
03/30/2018, 12:44 PMHome
is the type in the application schema, but it is backed by Place
in the Prisma data modelpatrick_madx
03/30/2018, 1:29 PMpatrick_madx
03/30/2018, 1:29 PMpatrick_madx
03/30/2018, 1:29 PMpatrick_madx
03/30/2018, 1:30 PMexport const Quotation = {
prices: {
fragment: `fragment LaneQuotationPrice on Quotation { id }`,
resolve: async ({ id }, args, ctx: Context, info) => {
return await calculateContainerPrice(ctx.db, id)
}
}
}