17 lines
675 B
Python
17 lines
675 B
Python
# Fetch MicroDAOs where orchestrator is on this node
|
|
print(f"DEBUG: Fetching microdaos for node {node_id}")
|
|
try:
|
|
microdaos = await pool.fetch("""
|
|
SELECT m.id, m.slug, m.name, COUNT(cr.id) as rooms_count
|
|
FROM microdaos m
|
|
JOIN agents a ON m.orchestrator_agent_id = a.id
|
|
LEFT JOIN city_rooms cr ON cr.microdao_id::text = m.id
|
|
WHERE a.node_id = $1
|
|
GROUP BY m.id, m.slug, m.name
|
|
ORDER BY m.name
|
|
""", node_id)
|
|
print(f"DEBUG: Microdaos fetched: {len(microdaos)}")
|
|
except Exception as e:
|
|
print(f"DEBUG: Error fetching microdaos: {e}")
|
|
raise e
|