Harden payment observability and polling
This commit is contained in:
@@ -84,14 +84,17 @@ class SbpWithdrawalRepository(ISbpWithdrawalRepository):
|
||||
return self._to_entity(model)
|
||||
|
||||
|
||||
async def list_by_user_id(self,*,user_id: str,limit: int,offset: int) -> list[SbpWithdrawalEntity]:
|
||||
async def list_by_user_id(self,*,user_id: str,limit: int,offset: int,cursor_created_at=None) -> list[SbpWithdrawalEntity]:
|
||||
stmt=(
|
||||
select(SbpWithdrawal)
|
||||
.where(SbpWithdrawal.user_id==user_id)
|
||||
.order_by(desc(SbpWithdrawal.created_at))
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
)
|
||||
if cursor_created_at is not None:
|
||||
stmt=stmt.where(SbpWithdrawal.created_at < cursor_created_at)
|
||||
else:
|
||||
stmt=stmt.offset(offset)
|
||||
result=await self._session.scalars(stmt)
|
||||
return [self._to_entity(model) for model in result.all()]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user