Skip to content

Commit

Permalink
Fix bug in delete examples (#105)
Browse files Browse the repository at this point in the history
Backend fix bug in delete examples
  • Loading branch information
eyurtsev committed Mar 23, 2024
1 parent dd3076a commit 6a6087b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/server/api/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def delete(
user_id: UUID = Depends(UserToken),
) -> None:
"""Endpoint to delete an example."""
extractor_id = session.query(Example).filter_by(uuid=str(uuid)).first().extractor_id
example = session.query(Example).filter_by(uuid=str(uuid)).first()
if example is None:
raise HTTPException(status_code=404, detail="Example not found.")
extractor_id = example.extractor_id
if not validate_extractor_owner(session, extractor_id, user_id):
raise HTTPException(status_code=404, detail="Extractor not found for owner.")
session.query(Example).filter_by(uuid=str(uuid)).delete()
Expand Down

0 comments on commit 6a6087b

Please sign in to comment.