-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I have two lists, Product
and ProductRange
. There is a many-to-one relationship between these lists, so each Product
is linked to a single ProductRange
. This means that I have a field called productRangeId
in the Prisma model for Product
.
I want to use this field to sort any queries for multiple products, so products from the same range are grouped together. I'm attempting to do this by extending my schema as shown in the docs. My code is below.
export function extendGraphqlSchema(baseSchema: GraphQLSchema) {
return mergeSchemas({
schemas: [baseSchema],
typeDefs: `
type Query {
products(where: ProductWhereInput): [Product]!
}`,
resolvers: {
Query: {
products: (root, { where, orderBy, skip, take }, context: Context, info: GraphQLResolveInfo) => {
return context.prisma.product.findMany({ orderBy: { 'productRangeId': 'asc' }, skip, take, where });
},
}
},
})
}
This works as expected in the API explorer, but no products are listed in the admin UI - see screengrabs.
However if I remove the where
param from the findMany
query (see below) it seems to fix the issue in admin.
...
products: (root, { where, orderBy, skip, take }, context: Context, info: GraphQLResolveInfo) => {
return context.prisma.product.findMany({ orderBy: { 'productRangeId': 'asc' }, skip, take });
},
...
For requests from admin the where
query is { OR: [] }
. Obviously this isn't really doing anything and could be tested for and removed, but wanted to ask whether there an issue with my approach, or is this a bug?


Node is v24.7.0
@keystone-6/core is 6.5.1
Browser is Safari
Thanks for you efforts building Keystone - it's great!!