diff --git a/app.py b/app.py index fb39206..45614b1 100644 --- a/app.py +++ b/app.py @@ -240,8 +240,8 @@ if __name__ == "__main__": def api_graph_edges(): conn = get_db() cur = conn.cursor() - cur.execute("SELECT id, h_a, h_b, weight FROM graph ORDER BY weight DESC") - edges = [{"id": r[0], "source_h": r[1], "target_h": r[2], "weight": r[3], "type": "db"} for r in cur.fetchall()] + cur.execute("SELECT id, h_a, h_b, weight, edge_type FROM graph ORDER BY weight DESC") + edges = [{"id": r[0], "source_h": r[1], "target_h": r[2], "weight": r[3], "type": r[4] or "db"} for r in cur.fetchall()] cur.close() conn.close() return jsonify({"count": len(edges), "edges": edges}) @@ -259,7 +259,7 @@ def api_graph_edges_create(): conn = get_db() cur = conn.cursor() - cur.execute("INSERT INTO graph (h_a, h_b, weight) VALUES (%s, %s, %s) RETURNING id", (source_h, target_h, weight)) + cur.execute("INSERT INTO graph (h_a, h_b, weight, edge_type) VALUES (%s, %s, %s, %s) RETURNING id", (source_h, target_h, weight, edge_type)) new_id = cur.fetchone()[0] conn.commit() cur.close()