Closed igorbenav closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
adf9ab0
) to head (7bbe7db
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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 supported_filters
list somewhere easy to access outside FastCRUD so we can also use advanced filters in the automatic endpoints.
The filter is wonderful! But can it be applied on joined models?
For example, filter user by user.company.name == 'A'
? Or filter company by user's name, company.users.any(User.name == 'B')
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