Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internal kernel API /api/filetree/listDocTree #10482

Closed
frostime opened this issue Mar 2, 2024 · 1 comment
Closed

Add internal kernel API /api/filetree/listDocTree #10482

frostime opened this issue Mar 2, 2024 · 1 comment
Assignees
Milestone

Comments

@frostime
Copy link
Contributor

frostime commented Mar 2, 2024

API Request | List the document tree structure

In what scenarios do you need this feature?

编写插件需要列举制定文档下方的完整的文档树结构。

此前的实现方案有根据 SQL 查询的、有根据 /api/file/readDir 搜索的,但是都要自己一层一层的广搜,需要发很多次 API 请求。

我觉得让后端直接实现一个遍历树的功能可能会更方便快捷一点。

Describe the optimal solution

  • Endpoint:/api/filetree/listDocTree

  • 功能:列出给定的根节点下方的完整的文档树结构

  • 参数

    • path: 文档的 path

      • 可以是文档的路径如 /20210917220500-sz588nq/20210917220056-yxtyl7i
      • 也可以是一个根目录 /
    • notebook: NoteBook ID

      • path/ 或者空的时候,列出 notebook 笔记本下的所有的文档树
  • 返回:返回完整的文档树结构, 不包括根节点

    {
      "code": 0,
      "msg": "",
      "data": [
        {
          "id": "<Document ID>",
          "children": null
        },
        {
          "id": "<Document ID>",
          "children": [
              {
                "id": "<Document ID>",
                "children": null
              },
          ]
        }
      ]
    }

Describe the candidate solution

No response

Other information

No response

@88250 88250 self-assigned this Mar 2, 2024
@88250 88250 added this to the 3.0.3 milestone Mar 5, 2024
@88250 88250 changed the title API Request | List the document tree structure Add kernel API /api/filetree/listDocTree Mar 5, 2024
@88250
Copy link
Member

88250 commented Mar 5, 2024

http://127.0.0.1:6806/api/filetree/listDocTree

参数:

{
    "notebook": "20220407175815-lceq17w",
    "path": "/"
}

返回:

{
    "code": 0,
    "msg": "",
    "data": {
        "tree": [
            {
                "id": "20221126104620-m06prws",
                "children": [
                    {
                        "id": "20230928134805-z11t56h"
                    },
                    {
                        "id": "20231013134532-3426q9j",
                        "children": [
                            {
                                "id": "20231013134532-60uygtt"
                            },
                            {
                                "id": "20231013134532-iny1x49"
                            },
                            {
                                "id": "20231013134532-ng249k4"
                            },
                            {
                                "id": "20231013134532-o1xpgpz"
                            },
                            {
                                "id": "20231013134532-u01x7ar",
                                "children": [
                                    {
                                        "id": "20231013134532-8q4vgf9",
                                        "children": [
                                            {
                                                "id": "20231013134532-evoj3rm"
                                            }
                                        ]
                                    },
                                    {
                                        "id": "20231013134532-ugrcquk",
                                        "children": [
                                            {
                                                "id": "20231013134532-yffdan3",
                                                "children": [
                                                    {
                                                        "id": "20231013134532-9doj565"
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "id": "20231013134532-uiew8a0"
                            }
                        ]
                    },
                    {
                        "id": "20231219230432-4o43kb5",
                        "children": [
                            {
                                "id": "20240226080709-3wawj1e",
                                "children": [
                                    {
                                        "id": "20240226083928-ybgmj6j"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "20240107222025-sha60hj",
                        "children": [
                            {
                                "id": "20240303163613-n04yuyu"
                            },
                            {
                                "id": "20240303170000-j68d6zp"
                            },
                            {
                                "id": "20240303170855-kj6t2y2"
                            },
                            {
                                "id": "20240303170916-cdopw9k"
                            }
                        ]
                    },
                    {
                        "id": "20240109115126-46zrisf"
                    },
                    {
                        "id": "20240118204048-ohgbh7d"
                    },
                    {
                        "id": "20240229223722-jdvoav6"
                    },
                    {
                        "id": "20240301082613-m0l2vcd"
                    },
                    {
                        "id": "20240304105333-v7g5j1s",
                        "children": [
                            {
                                "id": "20240304105528-2ts7um3"
                            },
                            {
                                "id": "20240304210415-ykimhdw"
                            }
                        ]
                    },
                    {
                        "id": "20240304115504-1fblbba",
                        "children": [
                            {
                                "id": "20240116164611-qu06rhl"
                            }
                        ]
                    }
                ]
            },
            {
                "id": "20230816232910-dqumxfa",
                "children": [
                    {
                        "id": "20230908222739-1uk96qm",
                        "children": [
                            {
                                "id": "20230908213300-r4oa36t"
                            },
                            {
                                "id": "20230908222815-kr30g7s"
                            },
                            {
                                "id": "20230909145930-vsl2gs5"
                            }
                        ]
                    },
                    {
                        "id": "20230908222753-lh8y5pj",
                        "children": [
                            {
                                "id": "20230809110230-vwx0o1l"
                            },
                            {
                                "id": "20230815153936-vw6nr8c"
                            },
                            {
                                "id": "20230823094842-jgfwf3a"
                            },
                            {
                                "id": "20230826220650-ndrx0jb"
                            },
                            {
                                "id": "20230829163019-4x9vkbq"
                            }
                        ]
                    },
                    {
                        "id": "20230910090752-1z6h3cj",
                        "children": [
                            {
                                "id": "20231006095952-o2yl6dh",
                                "children": [
                                    {
                                        "id": "20231006100024-5rnhpml"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "20230921113853-7llmdlu",
                        "children": [
                            {
                                "id": "20230914084054-gsgsdqq"
                            },
                            {
                                "id": "20230922120635-jtitjuz"
                            }
                        ]
                    },
                    {
                        "id": "20230930155902-0hjqw9b",
                        "children": [
                            {
                                "id": "20230930155908-m8dfqde"
                            }
                        ]
                    },
                    {
                        "id": "20231016001650-t4zynjp",
                        "children": [
                            {
                                "id": "20231015224403-vbfoqh4"
                            }
                        ]
                    },
                    {
                        "id": "20231019231934-ejrmciw",
                        "children": [
                            {
                                "id": "20231019232031-iyrjdpf"
                            },
                            {
                                "id": "20231019232044-gpfh7rn"
                            },
                            {
                                "id": "20231022111051-sgxvqw8"
                            },
                            {
                                "id": "20231027120938-2ckluhf",
                                "children": [
                                    {
                                        "id": "20231027121026-9q7gtmd"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "20231023162743-lci0owb",
                        "children": [
                            {
                                "id": "20231023162850-l2rt8cg"
                            },
                            {
                                "id": "20231024085644-iz3xadz"
                            }
                        ]
                    },
                    {
                        "id": "20231025215624-q4joabz",
                        "children": [
                            {
                                "id": "20231025215634-oe6u7a8",
                                "children": [
                                    {
                                        "id": "20231025215745-nlfo4ty"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "20231110091057-2yi0aiz",
                        "children": [
                            {
                                "id": "20231110084756-01unmo5"
                            },
                            {
                                "id": "20231114213437-c0aqusb"
                            }
                        ]
                    },
                    {
                        "id": "20231208225340-tjwvl36"
                    }
                ]
            },
            {
                "id": "20231012194610-v0jqicu"
            },
            {
                "id": "20231116194604-5rbd1je"
            },
            {
                "id": "20231225220807-sj8uajj",
                "children": [
                    {
                        "id": "20240205203349-gwy9vbf"
                    }
                ]
            },
            {
                "id": "20231226233056-qfjpl80",
                "children": [
                    {
                        "id": "20230913101750-lhlgg8u"
                    }
                ]
            },
            {
                "id": "20240107180226-s7d75le",
                "children": [
                    {
                        "id": "20231220201332-xnc07gs"
                    },
                    {
                        "id": "20240107171512-d11936d"
                    }
                ]
            },
            {
                "id": "20240114224707-qkvp2y5",
                "children": [
                    {
                        "id": "20240114224718-2k4ts50"
                    }
                ]
            },
            {
                "id": "20240116110639-klk55e2"
            },
            {
                "id": "20240226092705-i58iqvp",
                "children": [
                    {
                        "id": "20240304131818-qwy3z9m"
                    }
                ]
            }
        ]
    }
}

@88250 88250 closed this as completed Mar 5, 2024
@88250 88250 changed the title Add kernel API /api/filetree/listDocTree Add internal kernel API /api/filetree/listDocTree Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants