fix: tree API 500 — missing parent_section in SELECT query
The roots query only had id, title columns but the tree builder accessed r['parent_section'] which didn't exist in the result row. Added parent_section to the SELECT to fix folder type detection.
This commit is contained in:
@@ -521,7 +521,7 @@ async def local_workspace_tree(request: Request):
|
|||||||
ws_id = ws["id"] if ws else None
|
ws_id = ws["id"] if ws else None
|
||||||
with get_conn() as conn:
|
with get_conn() as conn:
|
||||||
roots = conn.execute(
|
roots = conn.execute(
|
||||||
"SELECT id, title FROM pages WHERE parent_id IS NULL AND workspace_id=? ORDER BY created_at DESC",
|
"SELECT id, title, parent_section FROM pages WHERE parent_id IS NULL AND workspace_id=? ORDER BY created_at DESC",
|
||||||
(ws_id,),
|
(ws_id,),
|
||||||
).fetchall() if ws_id else []
|
).fetchall() if ws_id else []
|
||||||
tree = []
|
tree = []
|
||||||
|
|||||||
Reference in New Issue
Block a user