New alert service
This commit is contained in:
@@ -98,18 +98,27 @@ class ForecastEventConsumer:
|
||||
|
||||
async def _get_parent_tenant_id(self, tenant_id: str) -> Optional[str]:
|
||||
"""
|
||||
Get parent tenant ID for a child tenant
|
||||
In a real implementation, this would call the tenant service
|
||||
Get parent tenant ID for a child tenant using the tenant service
|
||||
"""
|
||||
# This is a placeholder implementation
|
||||
# In real implementation, this would use TenantServiceClient to get tenant hierarchy
|
||||
try:
|
||||
# Simulate checking tenant hierarchy
|
||||
# In real implementation: return await self.tenant_client.get_parent_tenant_id(tenant_id)
|
||||
|
||||
# For now, we'll return a placeholder implementation that would check the database
|
||||
# This is just a simulation of the actual implementation needed
|
||||
return None # Placeholder - real implementation needed
|
||||
from shared.clients.tenant_client import TenantServiceClient
|
||||
from shared.config.base import get_settings
|
||||
|
||||
# Create tenant client
|
||||
config = get_settings()
|
||||
tenant_client = TenantServiceClient(config)
|
||||
|
||||
# Get parent tenant information
|
||||
parent_tenant = await tenant_client.get_parent_tenant(tenant_id)
|
||||
|
||||
if parent_tenant:
|
||||
parent_tenant_id = parent_tenant.get('id')
|
||||
logger.info(f"Found parent tenant {parent_tenant_id} for child tenant {tenant_id}")
|
||||
return parent_tenant_id
|
||||
else:
|
||||
logger.debug(f"No parent tenant found for tenant {tenant_id} (tenant may be standalone or parent)")
|
||||
return None
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting parent tenant ID for {tenant_id}: {e}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user