Um... yeah.
This commit is contained in:
parent
207e3f5b51
commit
1cf76edf56
1 changed files with 2 additions and 1 deletions
|
|
@ -9,9 +9,10 @@ def _is_truthy(val):
|
||||||
return str(val).lower() in ('1', 'true', 'yes', 'on')
|
return str(val).lower() in ('1', 'true', 'yes', 'on')
|
||||||
|
|
||||||
class CRUDService(Generic[T]):
|
class CRUDService(Generic[T]):
|
||||||
def __init__(self, model: Type[T], session: Session):
|
def __init__(self, model: Type[T], session: Session, polymorphic: bool = False):
|
||||||
self.model = model
|
self.model = model
|
||||||
self.session = session
|
self.session = session
|
||||||
|
self.polymorphic = polymorphic
|
||||||
self.supports_soft_delete = hasattr(model, 'is_deleted')
|
self.supports_soft_delete = hasattr(model, 'is_deleted')
|
||||||
|
|
||||||
def get(self, id: int, include_deleted: bool = False) -> T | None:
|
def get(self, id: int, include_deleted: bool = False) -> T | None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue