🎨 Add internal kernel API /api/filetree/upsertIndexes and /api/filetree/removeIndexes https://github.com/siyuan-note/siyuan/issues/10079

This commit is contained in:
Daniel 2024-01-05 20:54:46 +08:00
parent 318e570343
commit 286654cb00
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 112 additions and 13 deletions

View file

@ -33,6 +33,40 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func upsertIndexes(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
pathsArg := arg["paths"].([]interface{})
var paths []string
for _, p := range pathsArg {
paths = append(paths, p.(string))
}
model.UpsertIndexes(paths)
}
func removeIndexes(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
pathsArg := arg["paths"].([]interface{})
var paths []string
for _, p := range pathsArg {
paths = append(paths, p.(string))
}
model.RemoveIndexes(paths)
}
func refreshFiletree(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)