Skip to content

Commit 500876c

Browse files
committed
Fix software deletion from UI
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.
1 parent ec89dcc commit 500876c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

goosebit/api/v1/software/requests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from pydantic import BaseModel
1+
from pydantic import RootModel
22

33

4-
class SoftwareDeleteRequest(BaseModel):
5-
files: list[int]
4+
class SoftwareDeleteRequest(RootModel[list[int]]):
5+
pass

goosebit/api/v1/software/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def software_get(_: Request) -> SoftwareResponse:
2626
)
2727
async def software_delete(_: Request, config: SoftwareDeleteRequest) -> StatusResponse:
2828
success = False
29-
for f_id in config.files:
29+
for f_id in config.root:
3030
software = await Software.get_or_none(id=f_id)
3131

3232
if software is None:

0 commit comments

Comments
 (0)