From 0b036195177679c4c05f2c2560c8c86ca7c615bc Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Thu, 4 Jul 2024 14:54:20 +0200 Subject: [PATCH] drop reduntant model param --- fastcrud/endpoint/crud_router.py | 1 - fastcrud/endpoint/endpoint_creator.py | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/fastcrud/endpoint/crud_router.py b/fastcrud/endpoint/crud_router.py index 8b087e2..0f48fc4 100644 --- a/fastcrud/endpoint/crud_router.py +++ b/fastcrud/endpoint/crud_router.py @@ -298,7 +298,6 @@ async def add_routes_to_router(self, ...): endpoint_creator_class = endpoint_creator or EndpointCreator endpoint_creator_instance = endpoint_creator_class( session=session, - model=model, crud=crud, create_schema=create_schema, update_schema=update_schema, diff --git a/fastcrud/endpoint/endpoint_creator.py b/fastcrud/endpoint/endpoint_creator.py index 4f15e1c..cead761 100644 --- a/fastcrud/endpoint/endpoint_creator.py +++ b/fastcrud/endpoint/endpoint_creator.py @@ -208,7 +208,6 @@ def get_current_user(token: str = Depends(oauth2_scheme)): def __init__( self, session: Callable, - model: ModelType, create_schema: Type[CreateSchemaType], update_schema: Type[UpdateSchemaType], crud: Optional[FastCRUD] = None, @@ -228,13 +227,8 @@ def __init__( } self.primary_key_names = [pk.name for pk in self._primary_keys] self.session = session - self.crud = crud or FastCRUD( - model=model, - is_deleted_column=is_deleted_column, - deleted_at_column=deleted_at_column, - updated_at_column=updated_at_column, - ) - self.model = model + self.crud = crud + self.model = self.crud.model self.create_schema = create_schema self.update_schema = update_schema self.delete_schema = delete_schema