Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

feature: @relation with order #38

Closed
bebbi opened this issue Mar 28, 2018 · 3 comments
Closed

feature: @relation with order #38

bebbi opened this issue Mar 28, 2018 · 3 comments

Comments

@bebbi
Copy link
Contributor

bebbi commented Mar 28, 2018

Ordering relations is oftentimes important.
Would it be possible to add an optional orderBy and orderByDesc to the @relation directive?
This should be able to order on fields that are not part of a selectionSet.

@johnymontana
Copy link
Contributor

As part of the schema augmentation process orderBy arguments are added to all relationship fields, including an enum for ordering in ascending/descending order by any of the scalar fields on the related type. However as per #47 there is a bug that prevents ordering in nested selections. Currently ordering only works at the top level operation, despite these orderBy arguments being added to the schema.

I'm closing this issue as a duplicate of #47 and let's track the issue there.

@appinteractive
Copy link

@johnymontana you closed both tickets but referencing them, was this intended?

@smkhalsa
Copy link
Contributor

smkhalsa commented Dec 1, 2018

@johnymontana I actually believe this needs additional discussion. An orderBy in the @relation directive would be useful for default ordering. As far as I'm aware, the only other way to create a default order currently would be to use a custom cypher directive.

I'd argue that providing a default order belongs in the graphql server layer rather than requiring clients to specify an order.

For example, in my use case, I have a workout app. Each workout has a list of exercises, and each exercise has a list of instructions. It is always the case that exercises and instructions would be in some default order. Therefore, it seems cumbersome to require the client to specify an order.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants