mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 08:30:42 +02:00
This commit is contained in:
parent
42c09e2fad
commit
29f73e1ef9
2 changed files with 24 additions and 10 deletions
|
@ -17,13 +17,33 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func addRiffCard(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
deckName := arg["deck"].(string)
|
||||
blockID := arg["blockID"].(string)
|
||||
err := model.AddFlashcard(blockID, deckName)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func createRiffDeck(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
@ -33,18 +53,11 @@ func createRiffDeck(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
id, rootID, content, isLargeDoc, err := model.OpenRepoSnapshotDoc(id)
|
||||
name := arg["name"].(string)
|
||||
err := model.CreateDeck(name)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"id": id,
|
||||
"rootID": rootID,
|
||||
"content": content,
|
||||
"isLargeDoc": isLargeDoc,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue