Skip to content

Commit

Permalink
refactor: show last deployments in ascending order
Browse files Browse the repository at this point in the history
  • Loading branch information
SteBaum committed Aug 5, 2024
1 parent de8296e commit 7d3f55a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tdp/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,16 @@ def get_deployments(
self, limit: Optional[int] = None, offset: Optional[int] = None
) -> Iterable[DeploymentModel]:
self._check_session()
subq = (
self.session.query(DeploymentModel)
.order_by(desc(DeploymentModel.id))
.limit(limit)
.subquery()
)
return (
self.session.query(DeploymentModel)
.join(subq, DeploymentModel.id == subq.c.id)
.order_by(DeploymentModel.id)
.limit(limit)
.offset(offset)
.all()
)

0 comments on commit 7d3f55a

Please sign in to comment.