Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions src/dispatch/project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def create_project(
[ErrorWrapper(ExistsError(msg="A project with this name already exists."), loc="name")],
model=ProjectCreate,
)
if project_in.id and get(db_session=db_session, project_id=project_in.id):
raise ValidationError(
[ErrorWrapper(ExistsError(msg="A project with this id already exists."), loc="id")],
model=ProjectCreate,
)

project = create(db_session=db_session, project_in=project_in)
background_tasks.add_task(
Expand Down
Loading