DocuRAG / Api /src /modules /uploadDocument /controllers /file_upload_controller.py
abadesalex's picture
infraestructure and feature upload
57cab59
raw
history blame
698 Bytes
import shutil
from typing import Any
from fastapi import HTTPException, UploadFile
from fastapi.responses import JSONResponse
from src.modules.uploadDocument.features.uploadDocument_feature import \
UploadDocumentFeature
class FileUploadController:
async def handle_file_upload(self, file: UploadFile) -> Any:
try:
print(file)
result = await UploadDocumentFeature.uploadFile(file)
message = result.get("message", "No message provided")
return JSONResponse(
status_code=200, content={"message": message}
)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))