data.oci_model: fix imports
This commit is contained in:
parent
069208f2f1
commit
e872c310d0
5 changed files with 45 additions and 32 deletions
|
@ -4,8 +4,8 @@ import json
|
|||
|
||||
from cnr.models.package_base import get_media_type
|
||||
|
||||
from data import oci_model
|
||||
from data.database import db_transaction, Manifest, ManifestListManifest, MediaType, Blob, Tag
|
||||
from data.oci_model import tag as tag_model
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -38,14 +38,14 @@ def get_or_create_manifest(manifest_json, media_type_name):
|
|||
|
||||
def get_manifest_types(repo, release=None):
|
||||
""" Returns an array of MediaTypes.name for a repo, can filter by tag """
|
||||
query = oci_model.tag.tag_alive_oci(Tag
|
||||
.select(MediaType.name)
|
||||
.join(ManifestListManifest,
|
||||
on=(ManifestListManifest.manifest_list == Tag.manifest_list))
|
||||
.join(MediaType,
|
||||
on=(ManifestListManifest.media_type == MediaType.id))
|
||||
.where(Tag.repository == repo,
|
||||
Tag.tag_kind == Tag.tag_kind.get_id('release')))
|
||||
query = tag_model.tag_alive_oci(Tag
|
||||
.select(MediaType.name)
|
||||
.join(ManifestListManifest,
|
||||
on=(ManifestListManifest.manifest_list == Tag.manifest_list))
|
||||
.join(MediaType,
|
||||
on=(ManifestListManifest.media_type == MediaType.id))
|
||||
.where(Tag.repository == repo,
|
||||
Tag.tag_kind == Tag.tag_kind.get_id('release')))
|
||||
if release:
|
||||
query = query.where(Tag.name == release)
|
||||
|
||||
|
|
Reference in a new issue