Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to sort by nested fields? #105

Closed
chriszrc opened this issue Jun 17, 2019 · 3 comments · Fixed by #146
Closed

Is it possible to sort by nested fields? #105

chriszrc opened this issue Jun 17, 2019 · 3 comments · Fixed by #146

Comments

@chriszrc
Copy link

It seems like maybe this should be possible, if I make a crud request like:

localhost/v1/api/health/?sort=death_age.death_age_code,ASC&filter....

It generates a query with this sort:

ORDER BY Death.death_age.death_age_code ASC

Which is the correct entity relationship, but not the correct way to generate the sql (it doesn't need that parent table reference to "Death")

@michaelyali
Copy link
Member

Seems like a bug. Do you wanna make a PR? :)

@chriszrc
Copy link
Author

chriszrc commented Jun 17, 2019 via email

@michaelyali
Copy link
Member

private getSort(query: ParsedRequestParams, options: QueryOptions) {
return query.sort && query.sort.length
? this.mapSort(query.sort)
: options.sort && options.sort.length
? this.mapSort(options.sort)
: {};
}

Maybe, could you point me in the right direction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants