fastcrud icon indicating copy to clipboard operation
fastcrud copied to clipboard

feat: Add support for OR and AND conditions in filtering

Open konradbeck-creditech opened this issue 10 months ago • 1 comments

Pull Request Template for FastCRUD

Description

This PR adds support for or_() and and_() in _parse_filters(), allowing for more flexible filtering when querying records.

Changes

  • Added support for or_() to enable filtering with multiple conditions using logical OR.
  • Introduced and_() to allow explicit AND grouping.
  • Improved error handling for empty lists in or_() and and_().
  • Refactored _parse_filters() for better readability and maintainability.

Tests

  • Added unit tests for or_() to verify multiple condition filtering.
  • Added unit tests for and_() to confirm AND logic works correctly.
  • Included a test combining or_() and and_() to ensure compatibility.
  • Maintained all existing tests without breaking changes.

Checklist

  • [✅] I have read the CONTRIBUTING document.
  • [✅ ] My code follows the code style of this project.
  • [❌] I have added necessary documentation (if appropriate).
  • [✅] I have added tests that cover my changes (if applicable).
  • [✅] All new and existing tests passed.

Additional Notes

This enhancement improves query flexibility while keeping backward compatibility. 🚀

konradbeck-creditech avatar Feb 27 '25 13:02 konradbeck-creditech

Hey, @konradbeck-creditech, can you please fix the checks?

igorbenav avatar Mar 20 '25 04:03 igorbenav