From a855e1d663eadd5027c7de78b5bc5b461d99267d Mon Sep 17 00:00:00 2001 From: Holger Joukl Date: Tue, 17 Jan 2023 11:52:07 +0100 Subject: [PATCH] Add basic filter query support (closes #6) --- src/datarest/_crudrouter_ext.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/datarest/_crudrouter_ext.py b/src/datarest/_crudrouter_ext.py index 776093c..638732b 100644 --- a/src/datarest/_crudrouter_ext.py +++ b/src/datarest/_crudrouter_ext.py @@ -1,3 +1,6 @@ +# A customized SLQAlchemyCRUDRouter subclass that adds filter query support. +# Gratefully adapted from https://github.com/awtkns/fastapi-crudrouter/pull/61 + import textwrap from typing import Any, Dict, List, Optional, Type, TypeVar, Union @@ -8,10 +11,7 @@ ) import pydantic -from . import _database - -# TODO: Refactor to separate module T = TypeVar("T", bound=pydantic.BaseModel) FILTER = Dict[str, Optional[Union[int, float, str, bool]]] @@ -43,7 +43,6 @@ def resp_status_code(response: Response): # - Take a look at dataclass and/or attrs # - see also https://github.com/tiangolo/fastapi/issues/4700 for potential # problems + hints -# Gratefully adapted from https://github.com/awtkns/fastapi-crudrouter/pull/61 def query_factory( schema: Type[T], query_params: Optional[List[str]] = None