menu

Prisma

🔴 The Prisma Spectrum community is not officially managed by Prisma's support team any more. Please seek help on GitHub or on Slack instead. Learn more: https://spectrum.chat/prisma/general/where-and-how-to-best-seek-help-with-questions-problems~687a1b8f-8658-4df3-8849-ea5ab3503f28

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# Beta
view-forward
# Community
view-forward
# GraphQL
view-forward
# OSS
view-forward
# Random
view-forward
Team

Nested filtering

April 14, 2020 at 6:37pm

Nested filtering

April 14, 2020 at 6:37pm (Edited 4 months ago)
I'm trying to recreate this graphql playground query with prisma-bindings
query {
customers(where: { id: "ck8zwslgs00da0712cq88e3oh" } ) {
id
cart(where: { dish: { restaurant: { id: "ck904gwl400mz0712v0azegm3" } } }) {
quantity
dish {
name
price
restaurant {
id
name
}
}
}
}
}
I've tried different queries:
const data = await ctx.db.query.customer({
where: {
id: args.customerID,
cart: {
dish: {
restaurant: {
where: {
id: args.restaurant
}
}
}
}
}
}, info)
const data = await ctx.db.query.customer({
where: {
id: args.customerID,
cart: {
where: {
dish: {
restaurant: {
id: args.restaurant
}
}
}
}
}
}, info)
const data = await ctx.db.query.customer({
where: {
id: args.customerID
},
cart: {
where: {
dish: {
restaurant: {
id: args.restaurant
}
}
}
}
}, info)
The first two are returning an error "Field \"cart\" is not defined by type CustomerWhereUniqueInput.". The last one just filters the first where and not the second one on the restaurant.
Can someone help me out?
No messages yet