浏览代码

:art: 支持数据快照对比 https://github.com/siyuan-note/siyuan/issues/6858

Liang Ding 2 年之前
父节点
当前提交
48b36d929f
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 4 1
      kernel/api/repo.go
  2. 4 4
      kernel/model/repository.go

+ 4 - 1
kernel/api/repo.go

@@ -70,7 +70,10 @@ func diffRepoSnapshots(c *gin.Context) {
 	}
 	}
 
 
 	ret.Data = map[string]interface{}{
 	ret.Data = map[string]interface{}{
-		"diff": diff,
+		"addsLeft":     diff.AddsLeft,
+		"updatesLeft":  diff.UpdatesLeft,
+		"updatesRight": diff.UpdatesRight,
+		"removesRight": diff.RemovesRight,
 	}
 	}
 }
 }
 
 

+ 4 - 4
kernel/model/repository.go

@@ -128,10 +128,10 @@ func OpenRepoSnapshotDoc(fileID string) (id, rootID, content string, isLargeDoc
 }
 }
 
 
 type LeftRightDiff struct {
 type LeftRightDiff struct {
-	AddsLeft     []*DiffFile
-	UpdatesLeft  []*DiffFile
-	UpdatesRight []*DiffFile
-	RemovesRight []*DiffFile
+	AddsLeft     []*DiffFile `json:"addsLeft"`
+	UpdatesLeft  []*DiffFile `json:"updatesLeft"`
+	UpdatesRight []*DiffFile `json:"updatesRight"`
+	RemovesRight []*DiffFile `json:"removesRight"`
 }
 }
 
 
 type DiffFile struct {
 type DiffFile struct {