Skip to content

Conversation

rubenghio
Copy link
Contributor

This is a simple and quick idea to support "IN" clause based on jsonapi specification:

filter[id]=1,2,3

Hope this helps

@coveralls
Copy link

coveralls commented Aug 23, 2020

Pull Request Test Coverage Report for Build 26

  • 6 of 7 (85.71%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 82.609%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flask_combo_jsonapi/querystring.py 6 7 85.71%
Totals Coverage Status
Change from base Build 13: 0.003%
Covered Lines: 1254
Relevant Lines: 1518

💛 - Coveralls

@Znbiz
Copy link
Contributor

Znbiz commented Aug 23, 2020

Hello, @rubenghio
Thanks for contributing to libraries

If the field in the database is of the List type, for example list_user = db.Column(db.List). In this case, we will no longer be able to simply filter out all records that have only 1.3 in the list ...

If you need in, use filter=[{"name": "id", "op": "in_", "val": [1, 2, 3]}]

@mahenzon
Copy link
Collaborator

Please consider providing tests for both cases when it's an array on the backend and when it's an int/str

from #35:

I think we have to do it this way: if value on the backend is not a collection type (not an ARRAY), but is an int or str, we should replace eq filter with in_ and parse incoming data as a list, not as a single value.

@igieon
Copy link
Contributor

igieon commented Jun 11, 2021

I submit pull request where you can use your custom QueryStringManager with test so you can use change eq and in as it is proposed in this request. Its this pull request #54 . Also in test method test_sqlalchemy_data_layer.test_get_list_with_simple_filter_relationship_custom_qs

@mahenzon
Copy link
Collaborator

mahenzon commented Aug 3, 2023

looks good

@roman-adcombo roman-adcombo merged commit 4a5f57a into AdCombo:master Jan 12, 2024
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 this pull request may close these issues.

6 participants