🎨 Add kernel API /api/filetree/getIDsByHPath https://github.com/siyuan-note/siyuan/issues/9654

This commit is contained in:
Daniel 2023-11-15 09:08:41 +08:00
parent 8eb5e53f81
commit 38099e4892
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 115 additions and 2 deletions

View file

@ -249,6 +249,36 @@ func getFullHPathByID(c *gin.Context) {
ret.Data = hPath
}
func getIDsByHPath(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
if nil == arg["path"] {
return
}
if nil == arg["notebook"] {
return
}
notebook := arg["notebook"].(string)
if util.InvalidIDPattern(notebook, ret) {
return
}
p := arg["path"].(string)
ids, err := model.GetIDsByHPath(p, notebook)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = ids
}
func moveDocs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)