#3 add pots and get for minio

This commit is contained in:
Martin Weick
2020-12-02 10:16:59 +01:00
parent f104795c17
commit 37b089881b
3 changed files with 47 additions and 2 deletions
+4 -2
View File
@@ -3,6 +3,7 @@ import json
import base64
from app_be.services.dropboxservice import DropboxService
from app_be.services.minioservice import MinioService
from app_be.services.wrapperservice import WrapperService
from app_be.views.mongo_db import MongoManager
@@ -66,7 +67,7 @@ class ImageEndpoint:
del metadata['_id']
dropbox_image_bytes = DropboxService.read_file(metadata['filename'])
#minio_image_bytes = MinioService.read_file(metadata['filename'])
if dropbox_image_bytes is None:
return JsonResponse({'Result': 'Error - could not find image in dropbox.', 'id': identifier}, status=404, safe=False)
@@ -101,6 +102,7 @@ class ImageEndpoint:
decoded_image = WrapperService.unwrap_file(b64encoded_image)
if not DropboxService.create_file(filename, decoded_image):
print("Could not save image to dropbox")
if not MinioService.create_file(filename, decoded_image):
print("Could not save image to minio")
return JsonResponse({'id': identifier, 'filename': filename},
safe=False) # 'metadata': metadata response beinhaltet ObjectId welche nicht serializable is?