-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[WIP] Filters in Automatic Endpoints #87
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 66 68 +2
Lines 4544 4819 +275
==========================================
+ Hits 4544 4819 +275 ☔ View full report in Codecov by Sentry. |
Btw @AndreGuerra123 @samuel-favarin-dbc you guys might be interested in taking a look at this |
@JakNowy not for this iteration, but for the next one we should get |
…pting dict instead of FilterConfig only
The filter is wonderful! But can it be applied on joined models? For example, filter user by |
This is a work in progress, but it will close #15. This PR adds optional filters to automatic endpoints.
filter_config
in bothEndpointCreator
andcrud_router
, dynamically add filters as query parametersget_multi
andget_paginated
only are changed byfilter_config
The usage idea after it is merged is something like:
Passing Filters as a Dict to
crud_router
Explanation:
/mymodel/get_multi?id=1&name=example
Passing Filters as Keyword Arguments to
EndpointCreator
It's also possible to use FilterConfig with keyword arguments or with
EndpointCreator
instead ofcrud_router
:Of course one could also pass as keyword arguments to
crud_router
or as a dict toEndpointCreator
.Notes:
get_multi
andget_paginated
only are getting filters. If people request, we may rethink thisdict
being passed instead of aFilterConfig