Improve AI logic

This commit is contained in:
Urtzi Alfaro
2025-11-05 13:34:56 +01:00
parent 5c87fbcf48
commit 394ad3aea4
218 changed files with 30627 additions and 7658 deletions

View File

@@ -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
# ================================================================