From 79cce050a418824320928f1600faacc02c27fad7 Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Tue, 14 Jan 2025 14:48:33 -0800 Subject: [PATCH] fix(org): disallow creation of org with same id --- src/dispatch/organization/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dispatch/organization/views.py b/src/dispatch/organization/views.py index 23aa75b05daa..d6e5c6115756 100644 --- a/src/dispatch/organization/views.py +++ b/src/dispatch/organization/views.py @@ -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)