Skip to content

Commit

Permalink
refactor: Create delete file controller (#69)
Browse files Browse the repository at this point in the history
* feat: delete file endpoint

Endpoint to delete files, no tests implemented yet

* fix: check format

check format error

* fix: Removing changes to init.py in controllers files_view.py files

* fix: check-linter problem

---------

Co-authored-by: Andvelavi <[email protected]>
  • Loading branch information
AndreaVelasquezA and Andvelavi authored Oct 18, 2023
1 parent b0a585c commit 079d755
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/controllers/files/remove_file/_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from src.config.soap_client import soap_client


def remove_file_handler(token, file_uuid):
try:
request_data = {"fileUUID": file_uuid, "token": token}
response = soap_client.service.file_delete(request_data)

if response["error"] is True:
return {"msg": response["msg"]}, response["code"]
else:
return {"msg": "File successfully deleted"}, 200

except Exception as e:
print("[Exception] remove_file_handler ->", e)
return {"msg": "There was an error deleting the file"}, 500
Empty file.

0 comments on commit 079d755

Please sign in to comment.