Skip to content

Commit

Permalink
clean: refactor resources routes
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Oct 17, 2024
1 parent 063e479 commit 1cfd040
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions udata_hydra/routes/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ async def create_resource(request: web.Request) -> web.Response:
if not document:
raise web.HTTPBadRequest(text="Missing document body")

dataset_id = valid_payload.dataset_id
resource_id = valid_payload.resource_id
dataset_id: str = str(valid_payload.dataset_id)
resource_id: str = str(valid_payload.resource_id)

await Resource.insert(
dataset_id=dataset_id,
Expand Down Expand Up @@ -103,7 +103,7 @@ async def update_resource(request: web.Request) -> web.Response:
if not document:
raise web.HTTPBadRequest(text="Missing document body")

dataset_id: str = valid_payload.dataset_id
dataset_id: str = str(valid_payload.dataset_id)
resource_id: str = str(valid_payload.resource_id)

await Resource.update_or_insert(dataset_id, resource_id, document.url)
Expand All @@ -118,7 +118,8 @@ async def delete_resource(request: web.Request) -> web.Response:
except ValidationError as err:
raise web.HTTPBadRequest(text=err.json())

resource: Record | None = await Resource.get(resource_id=str(valid_payload.resource_id))
resource_id: str = str(valid_payload.resource_id)
resource: Record | None = await Resource.get(resource_id=resource_id)
if not resource:
raise web.HTTPNotFound()

Expand Down

0 comments on commit 1cfd040

Please sign in to comment.