feat: ordering for getters

This commit is contained in:
2025-08-22 21:58:39 +04:00
parent 5e20da8356
commit c5e4dea52c
4 changed files with 14 additions and 7 deletions

View File

@ -9,7 +9,11 @@ from schemas.deal import UpdateDealSchema
class DealRepository(BaseRepository):
async def get_all(self, board_id: int) -> list[Deal]:
stmt = select(Deal).where(Deal.is_deleted.is_(False), Deal.board_id == board_id)
stmt = (
select(Deal)
.where(Deal.is_deleted.is_(False), Deal.board_id == board_id)
.order_by(Deal.lexorank)
)
result = await self.session.execute(stmt)
return list(result.scalars().all())