Skip to content

Support Order by Relations #5008

@cimchd

Description

@cimchd

I want to order a table by a nested attribute. I tried something like this:

const result = await prisma.posts.findMany({orderBy: { author: { name : 'desc' } } }) ;
console.log(results);

But I got an error:
Unknown arg ' user' in orderBy.user for type CustomerAccountOrderByInput.

When I checked the type PostOrderByInput there were only the scalar attributes of the post model available, the related models are missing.

Is it possible to extend the orderBy types to include the related models?

I detected this issue using nexus-prisma, @Weakky proposed to make it a prisma/photon issue: graphql-nexus/nexus-plugin-prisma#458

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions