Add pagination support to tag history API

Fixes #198
This commit is contained in:
Joseph Schorr 2015-06-30 11:38:58 +03:00
parent d9ce8fdf52
commit f7f10f4a6d
2 changed files with 19 additions and 6 deletions

View file

@ -1861,14 +1861,14 @@ def _tag_alive(query, now_ts=None):
(RepositoryTag.lifetime_end_ts > now_ts))
def list_repository_tag_history(repository, limit=100, specific_tag=None):
def list_repository_tag_history(repository, page=1, size=100, specific_tag=None):
query = (RepositoryTag
.select(RepositoryTag, Image)
.join(Image)
.where(RepositoryTag.repository == repository)
.where(RepositoryTag.hidden == False)
.order_by(RepositoryTag.lifetime_start_ts.desc())
.limit(limit))
.paginate(page, size))
if specific_tag:
query = query.where(RepositoryTag.name == specific_tag)