lrf 2 anni fa
parent
commit
fba847a6ee
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7 2
      app/service/table.js

+ 7 - 2
app/service/table.js

@@ -63,8 +63,13 @@ class TableService extends CrudService {
     for (const dir of dirs) {
       const { _id, children = [] } = dir;
       const dts = tables.filter((f) => ObjectId(f.dir).equals(_id));
-      dir.tables = dts;
-      if (children.length <= 0) continue;
+      if (children.length <= 0) {
+        children.push(...dts);
+        dir.children = children;
+        continue;
+      } else {
+        dir.children.push(...dts);
+      }
       const othersTables = tables.filter((f) => !ObjectId(f.dir).equals(_id));
       dir.children = this.compareTablesForDir(children, othersTables);
     }