refactor: Simplify repository classes by inheriting from BaseRepository and removing redundant methods

This commit is contained in:
JSC
2025-07-31 21:32:46 +02:00
parent c63997f591
commit 3405d817d5
8 changed files with 55 additions and 293 deletions

View File

@@ -38,7 +38,7 @@ class BaseRepository(Generic[ModelType]):
"""
try:
statement = select(self.model).where(getattr(self.model, "id") == entity_id)
statement = select(self.model).where(self.model.id == entity_id)
result = await self.session.exec(statement)
return result.first()
except Exception:
@@ -129,4 +129,4 @@ class BaseRepository(Generic[ModelType]):
except Exception:
await self.session.rollback()
logger.exception("Failed to delete %s", self.model.__name__)
raise
raise