Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Removed with atomic block for django tenant (#679)

Rahul Johnyd3ab07444b49
diff --git a/backend/account/authentication_controller.py b/backend/account/authentication_controller.py
index 38edce514..f8b41e921 100644
--- a/backend/account/authentication_controller.py
+++ b/backend/account/authentication_controller.py
@@ -35,7 +35,6 @@ from account.serializer import (
from account.user import UserService
from django.conf import settings
from django.contrib.auth import logout as django_logout
-from django.db import transaction
from django.db.utils import IntegrityError
from django.middleware import csrf
from django.shortcuts import redirect
@@ -166,33 +165,28 @@ class AuthenticationController:
organization = OrganizationService.get_organization_by_org_id(
organization_id
)
-
- # Django tenant migration will happen in the below code block
- with transaction.atomic(durable=True):
- if not organization:
- try:
- organization_data: OrganizationData = (
- self.auth_service.get_organization_by_org_id(
- organization_id
- )
- )
- except ValueError:
- raise OrganizationNotExist()
- try:
- organization = OrganizationService.create_organization(
- organization_data.name,
- organization_data.display_name,
- organization_data.id,
- )
- new_organization = True
- except IntegrityError:
- raise DuplicateData(
- f"{ErrorMessage.ORGANIZATION_EXIST}, \
- {ErrorMessage.DUPLICATE_API}"
- )
- organization_member = self.create_tenant_user(
- organization=organization, user=user
- )
+ if not organization:
+ try:
+ organization_data: OrganizationData = (
+ self.auth_service.get_organization_by_org_id(organization_id)
+ )
+ except ValueError:
+ raise OrganizationNotExist()
+ try:
+ organization = OrganizationService.create_organization(
+ organization_data.name,
+ organization_data.display_name,
+ organization_data.id,
+ )
+ new_organization = True
+ except IntegrityError:
+ raise DuplicateData(
+ f"{ErrorMessage.ORGANIZATION_EXIST}, \
+ {ErrorMessage.DUPLICATE_API}"
+ )
+ organization_member = self.create_tenant_user(
+ organization=organization, user=user
+ )
if new_organization:
try: