From 7aa95802d75c0a621ef54f30c510ae21e5f5705a Mon Sep 17 00:00:00 2001 From: Ben Brown <9870007+brownben@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:39:38 +0100 Subject: [PATCH] feat: default results links url when uploading from url --- backend/src/routes/upload.py | 3 +++ backend/src/schemas.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/routes/upload.py b/backend/src/routes/upload.py index 597474ff..8f9c2930 100644 --- a/backend/src/routes/upload.py +++ b/backend/src/routes/upload.py @@ -92,6 +92,9 @@ async def upload_results_file(request: UploadFileRequest) -> Message: async def upload_results_url(request: UploadURLRequest) -> Message: file = await get_document_from_url(request.url) + if not request.results_links.get("Standard Results"): + request.results_links["Standard Results"] = request.url + return await process_upload_file( request.event_id, request.upload_key, diff --git a/backend/src/schemas.py b/backend/src/schemas.py index 65a65b57..e2435d1b 100644 --- a/backend/src/schemas.py +++ b/backend/src/schemas.py @@ -164,7 +164,7 @@ class UploadRequest(BaseModel): overwrite: bool = False partial: bool = False - results_links: Optional[dict[str, HttpUrl | Literal[""]]] + results_links: dict[str, HttpUrl | Literal[""]] = {} class UploadFileRequest(UploadRequest): @@ -172,7 +172,7 @@ class UploadFileRequest(UploadRequest): class UploadURLRequest(UploadRequest): - url: str + url: HttpUrl class LeagueResultScore(BaseModel):