🎨 The data history of a database view should follow the doc history and data snapshot https://github.com/siyuan-note/siyuan/issues/9567

This commit is contained in:
Daniel 2023-11-23 11:22:35 +08:00
parent 4ca62ef701
commit bf6ff5bc32
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 119 additions and 2 deletions

View file

@ -26,6 +26,46 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func renderHistoryAttributeView(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)
created := arg["created"].(string)
view, attrView, err := model.RenderHistoryAttributeView(id, created)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
var views []map[string]interface{}
for _, v := range attrView.Views {
view := map[string]interface{}{
"id": v.ID,
"name": v.Name,
"type": v.LayoutType,
}
views = append(views, view)
}
ret.Data = map[string]interface{}{
"name": attrView.Name,
"id": attrView.ID,
"viewType": view.GetType(),
"viewID": view.GetID(),
"views": views,
"view": view,
"isMirror": av.IsMirror(attrView.ID),
}
}
func renderAttributeView(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)