added Service Class for MongoDB

This commit is contained in:
Manuel Hude
2020-12-06 14:57:57 +01:00
parent e6f54951e6
commit bd5247f21e
2 changed files with 15 additions and 5 deletions
+2 -3
View File
@@ -54,6 +54,7 @@ class ImageEndpoint:
safe=False)
stored_hash = metadata.get('sha512', '')
print(stored_hash)
actual_dropbox_hash = create_sha512(dropbox_image_bytes)
if stored_hash != actual_dropbox_hash:
@@ -84,11 +85,9 @@ class ImageEndpoint:
metadata = payload['metadata']
filename = payload['metadata']['filename']
decoded_image = WrapperService.unwrap_file(b64encoded_image)
metadata['sha512'] = create_sha512(decoded_image)
MongoDBService.createSingle(metadata,identifier)
MongoDBService.createSingle(metadata,identifier,decoded_image)
if not DropboxService.create_file(filename, decoded_image):
print("Could not save image to dropbox")