forked from UpstreamDataInc/goosebit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request UpstreamDataInc#94 from UpstreamDataInc/dev_refact…
…or_bff_api Use only BFF from UI
- Loading branch information
Showing
17 changed files
with
220 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from pydantic import RootModel | ||
from pydantic import BaseModel | ||
|
||
|
||
class SoftwareDeleteRequest(RootModel[list[int]]): | ||
pass | ||
class SoftwareDeleteRequest(BaseModel): | ||
software_ids: list[int] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from __future__ import annotations | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class DevicesPatchRequest(BaseModel): | ||
devices: list[str] | ||
software: str | None = None | ||
name: str | None = None | ||
pinned: bool | None = None | ||
feed: str | None = None | ||
force_update: bool | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .routes import router # noqa : F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from fastapi import APIRouter, HTTPException | ||
from fastapi.requests import Request | ||
from fastapi.responses import FileResponse, RedirectResponse | ||
|
||
from goosebit.db.models import Software | ||
|
||
router = APIRouter(prefix="/download", tags=["download"]) | ||
|
||
|
||
@router.get("/{file_id}") | ||
async def download_file(_: Request, file_id: int): | ||
software = await Software.get_or_none(id=file_id) | ||
if software is None: | ||
raise HTTPException(404) | ||
if software.local: | ||
return FileResponse( | ||
software.path, | ||
media_type="application/octet-stream", | ||
filename=software.path.name, | ||
) | ||
else: | ||
return RedirectResponse(url=software.uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.