From cbb70307f50dcd8de32903f79e90cd04c4b062b5 Mon Sep 17 00:00:00 2001 From: Cristobal Aguirre <34848638+jcaguirre89@users.noreply.github.com> Date: Fri, 18 Oct 2019 11:22:50 -0700 Subject: [PATCH 1/2] Fix typo in `read_item` GET view Swapped `read_user_me` for `read_item` for the single item get request. Looks like it was copied from the user paths and not updated. Doesn't change functionality but is more readable as it didn't make sense to have it called `read_user_me` and might be confusing. While I was at it I also updated the status code for not found to 404, so it's a more helpful error message if not found. --- .../backend/app/app/api/api_v1/endpoints/items.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/items.py b/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/items.py index 131e9852d4..ec6748e8c8 100644 --- a/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/items.py +++ b/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/items.py @@ -66,7 +66,7 @@ def update_item( @router.get("/{id}", response_model=Item) -def read_user_me( +def read_item( *, db: Session = Depends(get_db), id: int, @@ -77,7 +77,7 @@ def read_user_me( """ item = crud.item.get(db_session=db, id=id) if not item: - raise HTTPException(status_code=400, detail="Item not found") + raise HTTPException(status_code=404, detail="Item not found") if not crud.user.is_superuser(current_user) and (item.owner_id != current_user.id): raise HTTPException(status_code=400, detail="Not enough permissions") return item From af4016ccc1bfa705028880071686bbbe0cd89843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 7 Feb 2020 21:19:23 +0100 Subject: [PATCH 2/2] :green_heart: Trigger CI