DepartmentService::getHierarchicalTree() with configurable limits to prevent memory issues on large datasets. Organization-scoped: filters users by the current tenant's organization ID.curl --location 'https://api-dev.commandroom.ai/api/api/departments/tree?org_chart_id=15&include_users=true&max_teams=10&max_users=10&max_depth=2' \
--header 'Authorization: Bearer {{token}}' \
--header 'X-Tenant-UUID: '{
"success": true,
"data": [
{
"id": 1,
"type": "department",
"name": "Sample Name",
"description": "Sample description text.",
"original_id": 1,
"teams_count": 10,
"users_count": 10,
"parent_id": 1,
"has_more": true,
"depth_limit_reached": true,
"lazy_load_hint": "string",
"goteam_id": 1,
"email": "user@example.com",
"assignment_type": "team",
"is_team_lead": true,
"children": [
{}
]
}
]
}