chore: initial commit of HouseholdBudgetBook (backend, frontend, desktop)
This commit is contained in:
commit
4a5db3f1f9
167 files changed
+21732
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"household-book/service"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type BackupHandler struct{ svc *service.BackupService }
|
||||
|
||||
func NewBackupHandler(s *service.BackupService) *BackupHandler { return &BackupHandler{svc: s} }
|
||||
func (h *BackupHandler) Status(c *gin.Context) {
|
||||
v, e := h.svc.Status()
|
||||
if e != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "获取备份状态失败"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, v)
|
||||
}
|
||||
func (h *BackupHandler) Create(c *gin.Context) {
|
||||
v, e := h.svc.Create(c.Request.Context())
|
||||
if e != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "创建备份失败"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, v)
|
||||
}
|
||||
Reference in new issue
Block a user