Alter: 400 to more specific 409 conflict status code

This commit is contained in:
Abdullah Mustapha 2024-01-02 09:24:55 +01:00
parent 6d76a6f19b
commit a327c9c95d
2 changed files with 11 additions and 10 deletions

11
apps/api/.gitignore vendored
View file

@ -163,9 +163,8 @@ dmypy.json
# Cython debug symbols
cython_debug/
.idea/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Pipfile
Pipfile.lock
run.py

View file

@ -93,7 +93,9 @@ async def update_install_instance(
# Install Default roles
async def install_default_elements( data: dict, db_session: Session):
async def install_default_elements(db_session: Session):
"""
"""
# remove all default roles
statement = select(Role).where(Role.role_type == RoleTypeEnum.TYPE_GLOBAL)
roles = db_session.exec(statement).all()
@ -315,7 +317,7 @@ async def install_create_organization_user(
if not org.first():
raise HTTPException(
status_code=400,
status_code=409,
detail="Organization does not exist",
)
@ -325,7 +327,7 @@ async def install_create_organization_user(
if result.first():
raise HTTPException(
status_code=400,
status_code=409,
detail="Username already exists",
)
@ -335,7 +337,7 @@ async def install_create_organization_user(
if result.first():
raise HTTPException(
status_code=400,
status_code=409,
detail="Email already exists",
)