#3 add delete function
This commit is contained in:
@@ -113,6 +113,7 @@ class ImageEndpoint:
|
||||
|
||||
# get metadata from MongoDB
|
||||
metadata = MongoDBService.getSingle(identifier)
|
||||
|
||||
if not metadata:
|
||||
return JsonResponse({'Result': 'Error - could not find any metadata in mongoDB.',
|
||||
'id': identifier}, status=404, safe=False)
|
||||
@@ -120,10 +121,15 @@ class ImageEndpoint:
|
||||
resp = MongoDBService.deleteSingle(identifier)
|
||||
print(resp)
|
||||
|
||||
|
||||
if not DropboxService.delete_file(metadata['filename']):
|
||||
print('Error deleting file in dropbox')
|
||||
result_bool = False
|
||||
|
||||
if not MinioService.delete_file(metadata['filename']):
|
||||
print('Error deleting file in minio')
|
||||
result_bool = False
|
||||
|
||||
return JsonResponse({'Result': result_bool}, safe=False)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user