@@ -50,7 +50,7 @@ def read_item(session: SessionDep, current_user: CurrentUser, id: uuid.UUID) ->
5050 if not item :
5151 raise HTTPException (status_code = 404 , detail = "Item not found" )
5252 if not current_user .is_superuser and (item .owner_id != current_user .id ):
53- raise HTTPException (status_code = 400 , detail = "Not enough permissions" )
53+ raise HTTPException (status_code = 403 , detail = "Not enough permissions" )
5454 return item
5555
5656
@@ -83,7 +83,7 @@ def update_item(
8383 if not item :
8484 raise HTTPException (status_code = 404 , detail = "Item not found" )
8585 if not current_user .is_superuser and (item .owner_id != current_user .id ):
86- raise HTTPException (status_code = 400 , detail = "Not enough permissions" )
86+ raise HTTPException (status_code = 403 , detail = "Not enough permissions" )
8787 update_dict = item_in .model_dump (exclude_unset = True )
8888 item .sqlmodel_update (update_dict )
8989 session .add (item )
@@ -103,7 +103,7 @@ def delete_item(
103103 if not item :
104104 raise HTTPException (status_code = 404 , detail = "Item not found" )
105105 if not current_user .is_superuser and (item .owner_id != current_user .id ):
106- raise HTTPException (status_code = 400 , detail = "Not enough permissions" )
106+ raise HTTPException (status_code = 403 , detail = "Not enough permissions" )
107107 session .delete (item )
108108 session .commit ()
109109 return Message (message = "Item deleted successfully" )
0 commit comments