Phase 1 of migrating APPR-specific tables to tables with the Appr
prefix
Fixes https://jira.coreos.com/browse/QUAY-950
This commit is contained in:
parent
6622f27c93
commit
113bb96f29
28 changed files with 699 additions and 176 deletions
|
@ -3,12 +3,14 @@ from peewee import prefetch
|
|||
|
||||
|
||||
from data import model
|
||||
from data.database import Repository, Namespace, Tag, ManifestListManifest
|
||||
from data.database import Repository, Namespace
|
||||
from data.appr_model import tag as tag_model
|
||||
|
||||
|
||||
def list_packages_query(namespace=None, media_type=None, search_query=None, username=None):
|
||||
def list_packages_query(models_ref, namespace=None, media_type=None, search_query=None,
|
||||
username=None):
|
||||
""" List and filter repository by search query. """
|
||||
Tag = models_ref.Tag
|
||||
fields = [model.repository.SEARCH_FIELDS.name.name]
|
||||
|
||||
if search_query is not None:
|
||||
|
@ -40,9 +42,9 @@ def list_packages_query(namespace=None, media_type=None, search_query=None, user
|
|||
.order_by(Tag.lifetime_start))
|
||||
|
||||
if media_type:
|
||||
tag_query = tag_model.filter_tags_by_media_type(tag_query, media_type)
|
||||
tag_query = tag_model.filter_tags_by_media_type(tag_query, media_type, models_ref)
|
||||
|
||||
tag_query = tag_model.tag_alive_oci(tag_query)
|
||||
tag_query = tag_model.tag_is_alive(tag_query, Tag)
|
||||
query = prefetch(repo_query, tag_query)
|
||||
|
||||
return query
|
||||
|
|
Reference in a new issue