Skip to content

Commit

Permalink
fix: Deprecated django tenant schema function replaced (#647)
Browse files Browse the repository at this point in the history
Replaced deprecated django tenant schema function
  • Loading branch information
chandrasekharan-zipstack authored Sep 20, 2024
1 parent 8bef0ba commit c9bfbfd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/api/deployment_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def construct_complete_endpoint(api_name: str) -> str:
Returns:
- str: The complete API endpoint URL.
"""
org_schema = connection.get_tenant().schema_name
org_schema = connection.tenant.schema_name
return f"{ApiExecution.PATH}/{org_schema}/{api_name}/"

@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions backend/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ def save(self, *args: Any, **kwargs: Any) -> None:
try:
original = APIDeployment.objects.get(pk=self.pk)
if original.api_name != self.api_name:
org_schema = connection.get_tenant().schema_name
org_schema = connection.tenant.schema_name
self.api_endpoint = (
f"{ApiExecution.PATH}/{org_schema}/{self.api_name}/"
)
except APIDeployment.DoesNotExist:
org_schema = connection.get_tenant().schema_name
org_schema = connection.tenant.schema_name

self.api_endpoint = f"{ApiExecution.PATH}/{org_schema}/{self.api_name}/"
super().save(*args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion backend/api_v2/deployment_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def construct_complete_endpoint(api_name: str) -> str:
Returns:
- str: The complete API endpoint URL.
"""
org_schema = connection.get_tenant().schema_name
org_schema = connection.tenant.schema_name
return f"{ApiExecution.PATH}/{org_schema}/{api_name}/"

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion backend/pipeline/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def api_key_data(self):

@property
def api_endpoint(self):
org_schema = connection.get_tenant().schema_name
org_schema = connection.tenant.schema_name
deployment_endpoint = settings.API_DEPLOYMENT_PATH_PREFIX + "/pipeline/api"
api_endpoint = f"{deployment_endpoint}/{org_schema}/{self.id}/"
return api_endpoint
Expand Down
4 changes: 2 additions & 2 deletions backend/platform_settings/platform_auth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def toggle_platform_key_status(
error: IntegrityError
"""
try:
organization = connection.get_tenant()
organization = connection.tenant
platform_key.modified_by = user
if action == PlatformServiceConstants.ACTIVATE:
active_keys: list[PlatformKey] = PlatformKey.objects.filter(
Expand Down Expand Up @@ -193,7 +193,7 @@ def list_platform_key_ids() -> list[PlatformKey]:
Any: List of platform keys.
"""
try:
organization_id = connection.get_tenant().id
organization_id = connection.tenant.id
platform_keys: list[PlatformKey] = PlatformKey.objects.filter(
organization=organization_id
)
Expand Down
2 changes: 1 addition & 1 deletion backend/platform_settings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create(self, request: Request) -> Response:
is_active = request.data.get(PlatformServiceConstants.IS_ACTIVE)
key_name = request.data.get(PlatformServiceConstants.KEY_NAME)

organization: Organization = connection.get_tenant()
organization: Organization = connection.tenant

PlatformAuthHelper.validate_token_count(organization=organization)

Expand Down

0 comments on commit c9bfbfd

Please sign in to comment.