Skip to content

Conversation

@AghastyGD
Copy link
Owner

@AghastyGD AghastyGD commented Mar 22, 2025

This PR introduces:

  1. Async Support:

    • Added the is_async parameter to register_model_routes , allowing users to configure routes as asynchronous or synchronous. The default is True (async).
    • Ensured compatibility with both sync and async operations.
  2. Enhanced fFltering:

    • Added parse_query_param function to handle query parameters in the format field=value, field:value, and comparison operators (>, <, >=, <=).
    • Added support for filtering with dynamic field validation.
  3. Global Error Handling:

    • Added ErrorHandlingMiddleware to provide consistent JSON responses for exceptions, supporting both sync and async requests.

Changes Made

  • Updated register_model_routes to include async support and pagination.
  • Enhanced filtering logic in helpers.py to support flexible query parameters.
  • Added ErrorHandlingMiddleware for global exception handling.

Impact

  • Backward-compatible changes.

Testing

  • Verified async and sync route behavior.
  • Tested filtering with various query parameter formats.
  • Validated pagination functionality with different strategies.
  • Ensured proper error handling with the new middleware.

- Introduced async support for routes in `register_model_routes_internal`.
- Added `is_async` parameter to allow configuration of async or sync mode (default is True).
- Updated route handlers to support both async and sync operations.
- Ensured backward compatibility with existing sync operations.
- Introduced `ErrorHandlingMiddleware` to handle exceptions and return JSON responses.
- Middleware catches all exceptions raised during request processing and returns appropriate JSON responses with status codes.
- Added support for both synchronous and asynchronous request handling.
- Logs unexpected errors and formats tracebacks for easier debugging.
- Implemented pagination for asynchronous routes,
- Enhanced filtering logic to support more flexible query parameters.
@AghastyGD AghastyGD added the enhancement New feature or request label Mar 22, 2025
@AghastyGD AghastyGD self-assigned this Mar 22, 2025
@AghastyGD AghastyGD changed the title Add Async support, Global Error handling, and enhanced filtering Add Async Support, Global Error Handling, and Enhanced Filtering Mar 22, 2025
@AghastyGD AghastyGD merged commit be8f74e into dev Mar 22, 2025
3 checks passed
@AghastyGD AghastyGD deleted the feature/asynchronous-operations branch March 29, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant