From a327c9c95dfbab55ccc50da9879274c269dfba70 Mon Sep 17 00:00:00 2001 From: Abdullah Mustapha Date: Tue, 2 Jan 2024 09:24:55 +0100 Subject: [PATCH] Alter: 400 to more specific 409 conflict status code --- apps/api/.gitignore | 11 +++++------ apps/api/src/services/install/install.py | 10 ++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/api/.gitignore b/apps/api/.gitignore index 07437551..010e2064 100644 --- a/apps/api/.gitignore +++ b/apps/api/.gitignore @@ -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 \ No newline at end of file diff --git a/apps/api/src/services/install/install.py b/apps/api/src/services/install/install.py index bc079957..84194d69 100644 --- a/apps/api/src/services/install/install.py +++ b/apps/api/src/services/install/install.py @@ -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", )