Skip to content

Commit

Permalink
feat: default results links url when uploading from url
Browse files Browse the repository at this point in the history
  • Loading branch information
brownben committed Apr 27, 2024
1 parent 0eafd75 commit 7aa9580
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions backend/src/routes/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ 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):
file: str


class UploadURLRequest(UploadRequest):
url: str
url: HttpUrl


class LeagueResultScore(BaseModel):
Expand Down

0 comments on commit 7aa9580

Please sign in to comment.