initial import for Open Source 🎉
This commit is contained in:
parent
1898c361f3
commit
9c0dd3b722
2048 changed files with 218743 additions and 0 deletions
24
data/model/oci/shared.py
Normal file
24
data/model/oci/shared.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from data.database import Manifest, ManifestLegacyImage, Image
|
||||
|
||||
def get_legacy_image_for_manifest(manifest_id):
|
||||
""" Returns the legacy image associated with the given manifest, if any, or None if none. """
|
||||
try:
|
||||
query = (ManifestLegacyImage
|
||||
.select(ManifestLegacyImage, Image)
|
||||
.join(Image)
|
||||
.where(ManifestLegacyImage.manifest == manifest_id))
|
||||
return query.get().image
|
||||
except ManifestLegacyImage.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
def get_manifest_for_legacy_image(image_id):
|
||||
""" Returns a manifest that is associated with the given image, if any, or None if none. """
|
||||
try:
|
||||
query = (ManifestLegacyImage
|
||||
.select(ManifestLegacyImage, Manifest)
|
||||
.join(Manifest)
|
||||
.where(ManifestLegacyImage.image == image_id))
|
||||
return query.get().manifest
|
||||
except ManifestLegacyImage.DoesNotExist:
|
||||
return None
|
Reference in a new issue