mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 00:08:49 +01:00
🎨 Add a kernel API /api/block/getBlockTreeInfos https://github.com/siyuan-note/siyuan/issues/11311
This commit is contained in:
parent
5d47fe4e86
commit
7d73482cfa
4 changed files with 120 additions and 22 deletions
|
|
@ -29,6 +29,24 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func getBlockTreeInfos(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
var ids []string
|
||||
idsArg := arg["ids"].([]interface{})
|
||||
for _, id := range idsArg {
|
||||
ids = append(ids, id.(string))
|
||||
}
|
||||
|
||||
ret.Data = model.GetBlockTreeInfos(ids)
|
||||
}
|
||||
|
||||
func getBlockSiblingID(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/block/swapBlockRef", model.CheckAuth, model.CheckReadonly, swapBlockRef)
|
||||
ginServer.Handle("POST", "/api/block/transferBlockRef", model.CheckAuth, model.CheckReadonly, transferBlockRef)
|
||||
ginServer.Handle("POST", "/api/block/getBlockSiblingID", model.CheckAuth, getBlockSiblingID)
|
||||
ginServer.Handle("POST", "/api/block/getBlockTreeInfos", model.CheckAuth, getBlockTreeInfos)
|
||||
|
||||
ginServer.Handle("POST", "/api/file/getFile", model.CheckAuth, getFile)
|
||||
ginServer.Handle("POST", "/api/file/putFile", model.CheckAuth, model.CheckReadonly, putFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue