Chris H
06/29/2018, 2:48 AMwhere object below?
homesInPriceRange: async (parent, args, ctx: Context, info) => {
const where = {
AND: [
{ pricing: { perNight_gte: args.min } },
{ pricing: { perNight_lte: args.max } },
],
}
return ctx.db.query.places({ where }, info)
},
and the gql aggregate thingie below:
numRatings: {
fragment: `fragment NumRatings on Place { id }`,
resolve: async ({ id }, args, ctx: Context, info) => {
const reviews = await ctx.db.query.reviewsConnection(
{ where: { place: { id } } },
gql`{ aggregate { count } }`,
)
return reviews.aggregate.count
},
},
I have been looking for some kind of reference on when you can use filter or that you can use min and max on an Int? Is google no longer serving me or is the documentation on this stuff sparse?Chris H
06/29/2018, 3:05 AM