Improve AI logic
This commit is contained in:
@@ -200,6 +200,31 @@ class TenantServiceClient(BaseServiceClient):
|
||||
error=str(e), tenant_id=tenant_id)
|
||||
return None
|
||||
|
||||
async def get_active_tenants(self, skip: int = 0, limit: int = 100) -> Optional[list]:
|
||||
"""
|
||||
Get all active tenants
|
||||
|
||||
Args:
|
||||
skip: Number of records to skip (pagination)
|
||||
limit: Maximum number of records to return
|
||||
|
||||
Returns:
|
||||
List of active tenant dictionaries
|
||||
"""
|
||||
try:
|
||||
# Call tenants endpoint (not tenant-scoped)
|
||||
result = await self._make_request(
|
||||
"GET",
|
||||
f"tenants?skip={skip}&limit={limit}"
|
||||
)
|
||||
if result:
|
||||
logger.info("Retrieved active tenants from tenant service",
|
||||
count=len(result) if isinstance(result, list) else 0)
|
||||
return result if result else []
|
||||
except Exception as e:
|
||||
logger.error("Error getting active tenants", error=str(e))
|
||||
return []
|
||||
|
||||
# ================================================================
|
||||
# UTILITY METHODS
|
||||
# ================================================================
|
||||
|
||||
Reference in New Issue
Block a user