Skip to content

Commit

Permalink
fix(org): disallow creation of org with same id
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 committed Jan 14, 2025
1 parent 264e6b2 commit 79cce05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dispatch/organization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def create_organization(
status_code=status.HTTP_409_CONFLICT,
detail=[{"msg": "An organization with this name already exists."}],
)
if organization_in.id and get(db_session=db_session, organization_id=organization_in.id):
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail=[{"msg": "An organization with this id already exists."}],
)

# we create the organization
organization = create(db_session=db_session, organization_in=organization_in)
Expand Down

0 comments on commit 79cce05

Please sign in to comment.