This repository was archived by the owner on Jun 14, 2026. It is now read-only.
Add multiple sort columns#56
Open
DavidPayne-Woodscamp wants to merge 2 commits into
Open
Conversation
kibertoad
reviewed
Apr 1, 2020
| | `eager=[children, parent.movies]` | Which relations to fetch eagerly for the result models. An objection.js relation expression. | | ||
| | `orderBy=firstName` | Sort the result by certain property. | | ||
| | `orderByDesc=firstName` | Sort the result by certain property in descending order. | | ||
| | `orderByAsc=group\|lastName` | Sort the result by more than one property in ascending order. | |
Collaborator
There was a problem hiding this comment.
This seems not very RESTful. Can you adjust the param structure to follow either
?foo=bar&foo=qux
or
?foo=bar,qux
, as suggested in https://medium.com/raml-api/arrays-in-query-params-33189628fa68 ?
kibertoad
reviewed
Apr 1, 2020
| | `eager=[children, parent.movies]` | Which relations to fetch eagerly for the result models. An objection.js relation expression. | | ||
| | `orderBy=firstName` | Sort the result by certain property. | | ||
| | `orderByDesc=firstName` | Sort the result by certain property in descending order. | | ||
| | `orderByAsc=group\|lastName` | Sort the result by more than one property in ascending order. | |
Collaborator
There was a problem hiding this comment.
Same should be documented for desc sorting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ability to sort on multiple columns. I done this by extending the
orderBy,orderByAscandorderByDescquery parameters.Multiple columns can be delimited by the
|character. I chose this character to be consistent with the way you specify multiple columns in the filter parameters.This was done in a backwards compatible way. All the existing unit tests still pass unmodified.
I have added two new unit tests to test this functionality.
I updated the readme.
In addition to this, I have also fixing a linting error I introduced in my previous merge request. I included this in a separate commit.