FusionWorks / react-admin-nestjsx-crud-dataprovider

Data provider which integrates React Admin with NestJS CRUD library
132 stars 26 forks source link

[Discussion/RFC] Configurable custom resources variants #9

Open Bnaya opened 5 years ago

Bnaya commented 5 years ago

In nestjsx/crud, by default, all relations are none-eager. To make them load, we need to add &join=... to the URL. (Or turn on eager true on the controller.) But what if, sometimes, we don't want them to be on? Or we want only some of them?

React admin and the current dataProvider api does not have a way to configure extra query params, but only filter & sort

But i have an idea for a possible solution: pack the wish params inside the resource name, in a way the dataProvider will understand.

Possible implementation: https://github.com/FusionWorks/react-admin-nestjsx-crud-dataprovider/pull/8/files#diff-1fdf421c05c1140f6d71444ea2b27638R218

Related: https://github.com/marmelab/react-admin/issues/3411 https://github.com/nestjsx/crud/issues/160

Additional points: customisable filter (One input -> several fields, event nested, with several different operators)

gganebnyi commented 5 years ago

Let us review this. We already had a similar issue when we had to filter on a related record. But we ended up in adding "id" field to entity class along with the related record field (like category and categoryId in product class).

Bnaya commented 5 years ago

Thanks! Aside of that immediate proposed change, I'm exploring additional paths to have a ability to configure the requests on the dataProvider side, As it seems react-admin seems won't change it on their end https://github.com/marmelab/react-admin/issues/3411#issuecomment-513205106

Bnaya commented 5 years ago

Any chance to chat directly somehow? :) My email: me@bnaya.net

gganebnyi commented 5 years ago

Replied over email

humbertowoody commented 4 years ago

Hi! Is there any update on this issue as well as the PR? Thanks in advance for such a great project :)

Bnaya commented 4 years ago

hey @humbertowoody you can use https://www.npmjs.com/package/bnaya_fork_ra-data-nest-crud for the meanwhile

humbertowoody commented 4 years ago

Thanks @Bnaya :) Will do!