refactor: Simplify repository classes by inheriting from BaseRepository and removing redundant methods
This commit is contained in:
@@ -94,15 +94,15 @@ class CreditTransactionRepository(BaseRepository[CreditTransaction]):
|
||||
select(CreditTransaction)
|
||||
.where(CreditTransaction.success == True) # noqa: E712
|
||||
)
|
||||
|
||||
|
||||
if user_id is not None:
|
||||
stmt = stmt.where(CreditTransaction.user_id == user_id)
|
||||
|
||||
|
||||
stmt = (
|
||||
stmt.order_by(CreditTransaction.created_at.desc())
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
)
|
||||
|
||||
|
||||
result = await self.session.exec(stmt)
|
||||
return list(result.all())
|
||||
return list(result.all())
|
||||
|
||||
Reference in New Issue
Block a user