🧑‍💻 Add internal kernel API /api/attr/batchGetBlockAttrs https://github.com/siyuan-note/siyuan/issues/11786

This commit is contained in:
Daniel 2024-06-21 23:07:26 +08:00
parent 17dce8ebd2
commit 675ad65bd1
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 92 additions and 21 deletions

View file

@ -33,6 +33,24 @@ func getBookmarkLabels(c *gin.Context) {
ret.Data = model.BookmarkLabels()
}
func batchGetBlockAttrs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
ids := arg["ids"].([]interface{})
var idList []string
for _, id := range ids {
idList = append(idList, id.(string))
}
ret.Data = model.BatchGetBlockAttrs(idList)
}
func getBlockAttrs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -221,6 +221,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/attr/setBlockAttrs", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setBlockAttrs)
ginServer.Handle("POST", "/api/attr/batchSetBlockAttrs", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, batchSetBlockAttrs)
ginServer.Handle("POST", "/api/attr/getBlockAttrs", model.CheckAuth, getBlockAttrs)
ginServer.Handle("POST", "/api/attr/batchGetBlockAttrs", model.CheckAuth, batchGetBlockAttrs)
ginServer.Handle("POST", "/api/cloud/getCloudSpace", model.CheckAuth, model.CheckAdminRole, getCloudSpace)