Updates Dependencies, Creates Dockerfile and Formats Code

This commit is contained in:
2023-08-23 09:35:17 -03:00
parent f3e77889a2
commit 4d0ad4b104
8 changed files with 98 additions and 39 deletions

View File

@@ -4,7 +4,6 @@ from storage_service.controller.storage_controller import s3_router
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()

View File

@@ -20,14 +20,16 @@ s3_router = InferringRouter()
@cbv(s3_router)
class StorageController:
queue: Queue = Depends(dependency_queue, use_cache=True)
storage_service: StorageService = Depends(dependency_storage_service, use_cache=True)
storage_service: StorageService = Depends(
dependency_storage_service, use_cache=True
)
@s3_router.post("/new_file_url/", status_code=200)
def new_file_url(
self,
username: Annotated[str, Body(embed=True)],
file_postfix: Annotated[str, Body(embed=True)],
file_type: Annotated[FileType, Body(embed=True)],
self,
username: Annotated[str, Body(embed=True)],
file_postfix: Annotated[str, Body(embed=True)],
file_type: Annotated[FileType, Body(embed=True)],
) -> dict[str, str]:
return self.storage_service.get_temp_upload_link(
file_name_hash(username, file_postfix), file_type
@@ -40,7 +42,9 @@ class StorageController:
)
@s3_router.post("/process_file/", status_code=200)
def process_file(self,
username: Annotated[str, Body(embed=True)],
file_postfix: Annotated[str, Body(embed=True)]):
def process_file(
self,
username: Annotated[str, Body(embed=True)],
file_postfix: Annotated[str, Body(embed=True)],
):
self.queue.enqueue(storage_file_worker, username, file_postfix)