Add files via upload

This commit is contained in:
公明
2026-05-26 18:54:18 +08:00
committed by GitHub
parent 5560f34c6c
commit c56bf36df0
3 changed files with 24 additions and 2 deletions
+22 -1
View File
@@ -215,7 +215,9 @@ func (h *ProjectHandler) UpdateFact(c *gin.Context) {
if req.Summary != "" {
existing.Summary = req.Summary
}
existing.Body = req.Body
if strings.TrimSpace(req.Body) != "" {
existing.Body = req.Body
}
if req.Confidence != "" {
existing.Confidence = req.Confidence
}
@@ -260,3 +262,22 @@ func (h *ProjectHandler) DeprecateFact(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"success": true})
}
type restoreFactRequest struct {
FactKey string `json:"fact_key" binding:"required"`
Confidence string `json:"confidence"` // 可选:confirmed | tentative,默认 tentative
}
// RestoreFact POST /api/projects/:id/facts/restore
func (h *ProjectHandler) RestoreFact(c *gin.Context) {
var req restoreFactRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
if err := h.db.RestoreProjectFact(c.Param("id"), req.FactKey, req.Confidence); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{"success": true})
}