Skip to content

Commit

Permalink
cant delete user with signed plates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mropat committed Mar 15, 2022
1 parent 191d26c commit 8bcf84d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions genotype_api/api/endpoints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def delete_user(
user: User = get_user(session=session, user_id=user_id)
if not user:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
if user.plates:
raise HTTPException(
status_code=status.HTTP_406_NOT_ACCEPTABLE,
detail="User previously signed plates, please archive instead",
)
session.delete(user)
session.commit()
session.flush()
Expand Down

0 comments on commit 8bcf84d

Please sign in to comment.