Skip to content

Commit 7193486

Browse files
committed
Fix graph route after AST refactor
1 parent 402ca58 commit 7193486

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/routes/graph.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
const express = require("express");
22
const router = express.Router();
3-
const graph = require("../graph");
3+
const { $: graph } = require("../graph");
44

55
router.get("/graph", (req, res) => {
66
const result = {};
77

88
for (const key in graph) {
99
const node = graph[key];
1010

11-
if (node.id && node.key) {
11+
if (node.key) {
1212
result[node.key] = node;
1313

1414
const tmp = {
15-
id: node.id,
15+
id: node.key,
1616
type: node.constructor.name,
1717
};
1818

1919
for (const prop in node) {
2020
const object = node[prop];
2121

22-
if (typeof object === "object" && object?.id) {
23-
tmp[prop] = object.id;
24-
} else if (typeof object === "object" && !object?.id) {
22+
if (typeof object === "object" && object?.key) {
23+
tmp[prop] = object.key;
24+
} else if (typeof object === "object" && !object?.key) {
2525
const list = [];
2626

2727
for (const innerProp in object) {
2828
const innerObject = object[innerProp];
2929

30-
if (typeof innerObject === "object" && innerObject?.id) {
31-
list.push(innerObject.id);
30+
if (typeof innerObject === "object" && innerObject?.key) {
31+
list.push(innerObject.key);
3232
}
3333
}
3434

0 commit comments

Comments
 (0)