Added delete all in dropbox service and iot client help command
This commit is contained in:
@@ -109,19 +109,35 @@ class ImageEndpoint:
|
||||
def image_api_delete(request: HttpRequest, identifier):
|
||||
|
||||
logger.debug('Image DELETE single call: {}'.format(request))
|
||||
result_bool = True
|
||||
|
||||
# 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)
|
||||
|
||||
resp = MongoDBService.deleteSingle(identifier)
|
||||
print(resp)
|
||||
|
||||
return JsonResponse({'Result': 'success1'}, safe=False)
|
||||
if not DropboxService.delete_file(metadata['filename']):
|
||||
print('Error deleting file in dropbox')
|
||||
result_bool = False
|
||||
|
||||
return JsonResponse({'Result': result_bool}, safe=False)
|
||||
|
||||
@staticmethod
|
||||
@api_view(['DELETE'])
|
||||
def image_api_delete_all(request: HttpRequest):
|
||||
|
||||
logger.debug('Image DELETE single call: {}'.format(request))
|
||||
result_bool = True
|
||||
|
||||
resp = MongoDBService.deleteAll()
|
||||
print(resp)
|
||||
|
||||
return JsonResponse({'Result': 'success1'}, safe=False)
|
||||
if not DropboxService.delete_all():
|
||||
print('Error deleting dropbox folder')
|
||||
result_bool = False
|
||||
|
||||
return JsonResponse({'Result': result_bool}, safe=False)
|
||||
|
||||
Reference in New Issue
Block a user