nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.09k stars 541 forks source link

Is it possible to sort by nested fields? #105

Closed chriszrc closed 5 years ago

chriszrc commented 5 years ago

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 commented 5 years ago

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

chriszrc commented 5 years ago

Maybe, could you point me in the right direction?

On Mon, Jun 17, 2019 at 3:29 PM Michael Yali notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nestjsx/crud/issues/105?email_source=notifications&email_token=AGEBMKJG6PNXPS45DGFZFBTP27QYHA5CNFSM4HYYG4T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX4GRLA#issuecomment-502818988, or mute the thread https://github.com/notifications/unsubscribe-auth/AGEBMKLYHM6C32GVIHVM6UTP27QYHANCNFSM4HYYG4TQ .

-- -- Chris Marx Senior Software Engineer ZevRoss - Know Your Data Data Science & Spatial Analysis 209 N. Aurora St, 2nd Floor Ithaca, NY 14850 www.zevross.com

michaelyali commented 5 years ago

https://github.com/nestjsx/crud/blob/f3d3c58a4c5b03a46b84189ef34e21581d39aa5a/packages/crud-typeorm/src/typeorm-crud.service.ts#L571-L577

Maybe, could you point me in the right direction?