Skip to content

Commit

Permalink
Fix software deletion from UI
Browse files Browse the repository at this point in the history
UI sends array of IDs as the payload, but backend expected object with files
property. Files is not a good naming, so adjusted backend.

UI however should always call the BFF, so some more work required. Not creating
a test case for this issue before this bigger refactoring.
  • Loading branch information
tsagadar committed Aug 27, 2024
1 parent ec89dcc commit 500876c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions goosebit/api/v1/software/requests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from pydantic import RootModel


class SoftwareDeleteRequest(BaseModel):
files: list[int]
class SoftwareDeleteRequest(RootModel[list[int]]):
pass
2 changes: 1 addition & 1 deletion goosebit/api/v1/software/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def software_get(_: Request) -> SoftwareResponse:
)
async def software_delete(_: Request, config: SoftwareDeleteRequest) -> StatusResponse:
success = False
for f_id in config.files:
for f_id in config.root:
software = await Software.get_or_none(id=f_id)

if software is None:
Expand Down

0 comments on commit 500876c

Please sign in to comment.