mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 08:48:49 +01:00
🎨 Database block supports export as CSV https://github.com/siyuan-note/siyuan/issues/10072
This commit is contained in:
parent
88d3eb4a00
commit
97012e75c6
3 changed files with 61 additions and 7 deletions
|
|
@ -33,6 +33,29 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func exportAttributeView(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
avID := arg["id"].(string)
|
||||
zipPath, err := model.ExportAv2CSV(avID)
|
||||
if nil != err {
|
||||
ret.Code = 1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"zip": zipPath,
|
||||
}
|
||||
}
|
||||
|
||||
func exportEPUB(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/export/exportODT", model.CheckAuth, exportODT)
|
||||
ginServer.Handle("POST", "/api/export/exportRTF", model.CheckAuth, exportRTF)
|
||||
ginServer.Handle("POST", "/api/export/exportEPUB", model.CheckAuth, exportEPUB)
|
||||
ginServer.Handle("POST", "/api/export/exportAttributeView", model.CheckAuth, exportAttributeView)
|
||||
|
||||
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd)
|
||||
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue