From 96532915f781d6370897d39b3c999bfaa65cb10e Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 1 Apr 2025 11:47:56 +0800 Subject: [PATCH] :technologist: Add an internal kernel API `/api/av/reloadAttributeView` https://github.com/siyuan-note/siyuan/issues/14491 --- kernel/api/av.go | 13 +++++++++++++ kernel/api/router.go | 1 + 2 files changed, 14 insertions(+) diff --git a/kernel/api/av.go b/kernel/api/av.go index 7be4b50d1..383a09cca 100644 --- a/kernel/api/av.go +++ b/kernel/api/av.go @@ -27,6 +27,19 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) +func reloadAttributeView(c *gin.Context) { + ret := gulu.Ret.NewResult() + defer c.JSON(http.StatusOK, ret) + + arg, ok := util.JsonArg(c, ret) + if !ok { + return + } + + id := arg["id"].(string) + model.ReloadAttrView(id) +} + func duplicateAttributeViewBlock(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) diff --git a/kernel/api/router.go b/kernel/api/router.go index 8c43706ee..b48e5e0d7 100644 --- a/kernel/api/router.go +++ b/kernel/api/router.go @@ -452,6 +452,7 @@ func ServeAPI(ginServer *gin.Engine) { ginServer.Handle("POST", "/api/av/getAttributeViewKeysByAvID", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getAttributeViewKeysByAvID) ginServer.Handle("POST", "/api/av/duplicateAttributeViewBlock", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, duplicateAttributeViewBlock) ginServer.Handle("POST", "/api/av/appendAttributeViewDetachedBlocksWithValues", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, appendAttributeViewDetachedBlocksWithValues) + ginServer.Handle("POST", "/api/av/reloadAttributeView", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadAttributeView) ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, model.CheckAdminRole, chatGPT) ginServer.Handle("POST", "/api/ai/chatGPTWithAction", model.CheckAuth, model.CheckAdminRole, chatGPTWithAction)