Fix issues
This commit is contained in:
@@ -478,6 +478,26 @@ async def activate_tenant_enhanced(
|
||||
detail="Failed to activate tenant"
|
||||
)
|
||||
|
||||
@router.get("/tenants/users/{user_id}", response_model=List[TenantResponse])
|
||||
@track_endpoint_metrics("tenant_get_user_tenants")
|
||||
async def get_user_tenants_enhanced(
|
||||
user_id: str = Path(..., description="User ID"),
|
||||
tenant_service: EnhancedTenantService = Depends(get_enhanced_tenant_service)
|
||||
):
|
||||
"""Get all tenants owned by a user - Fixed endpoint for frontend"""
|
||||
|
||||
try:
|
||||
tenants = await tenant_service.get_user_tenants(user_id)
|
||||
logger.info("Retrieved user tenants", user_id=user_id, tenant_count=len(tenants))
|
||||
return tenants
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Get user tenants failed", user_id=user_id, error=str(e))
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Failed to get user tenants"
|
||||
)
|
||||
|
||||
@router.get("/tenants/statistics", dependencies=[Depends(require_admin_role_dep)])
|
||||
@track_endpoint_metrics("tenant_get_statistics")
|
||||
async def get_tenant_statistics_enhanced(
|
||||
|
||||
Reference in New Issue
Block a user