Change repositories API endpoint to use the new registry data model
This commit is contained in:
parent
a96c5a7f64
commit
a9ebb183f9
1 changed files with 8 additions and 3 deletions
|
@ -5,6 +5,8 @@ from datetime import datetime, timedelta
|
|||
from auth.permissions import ReadRepositoryPermission
|
||||
from data import model
|
||||
from data.appr_model import channel as channel_model, release as release_model
|
||||
from data.registry_model import registry_model
|
||||
from data.registry_model.datatypes import RepositoryReference
|
||||
from endpoints.appr.models_cnr import model as appr_model
|
||||
from endpoints.api.repository_models_interface import RepositoryDataInterface, RepositoryBaseElement, Repository, \
|
||||
ApplicationRepository, ImageRepositoryRepository, Tag, Channel, Release, Count
|
||||
|
@ -154,13 +156,16 @@ class PreOCIModel(RepositoryDataInterface):
|
|||
for release in releases
|
||||
])
|
||||
|
||||
tags = model.tag.list_active_repo_tags(repo)
|
||||
repo_ref = RepositoryReference.for_repo_obj(repo)
|
||||
tags = registry_model.list_repository_tags(repo_ref, include_legacy_images=True)
|
||||
|
||||
start_date = datetime.now() - timedelta(days=MAX_DAYS_IN_3_MONTHS)
|
||||
counts = model.log.get_repository_action_counts(repo, start_date)
|
||||
|
||||
return ImageRepositoryRepository(base, [
|
||||
Tag(tag.name, tag.image.docker_image_id, tag.image.aggregate_size, tag.lifetime_start_ts,
|
||||
tag.tagmanifest.digest if hasattr(tag, 'tagmanifest') else None,
|
||||
Tag(tag.name, tag.legacy_image.docker_image_id, tag.legacy_image.aggregate_size,
|
||||
tag.lifetime_start_ts,
|
||||
tag.manifest_digest,
|
||||
tag.lifetime_end_ts) for tag in tags
|
||||
], [Count(count.date, count.count) for count in counts], repo.badge_token, repo.trust_enabled)
|
||||
|
||||
|
|
Reference in a new issue