feat: 添加预算管理功能,包括预算的创建、查询、更新、删除及进度计算。

This commit is contained in:
2026-01-29 21:43:35 +08:00
parent f1fa7b6c54
commit cf34f8b3d0
4 changed files with 112 additions and 35 deletions

View File

@@ -3,8 +3,8 @@ package handler
import (
"strconv"
"accounting-app/pkg/api"
"accounting-app/internal/service"
"accounting-app/pkg/api"
"github.com/gin-gonic/gin"
)
@@ -60,8 +60,6 @@ func (h *BudgetHandler) CreateBudget(c *gin.Context) {
api.BadRequest(c, err.Error())
case service.ErrInvalidPeriodType:
api.BadRequest(c, err.Error())
case service.ErrCategoryOrAccountRequired:
api.BadRequest(c, err.Error())
default:
api.InternalError(c, "Failed to create budget")
}
@@ -150,8 +148,6 @@ func (h *BudgetHandler) UpdateBudget(c *gin.Context) {
api.BadRequest(c, err.Error())
case service.ErrInvalidPeriodType:
api.BadRequest(c, err.Error())
case service.ErrCategoryOrAccountRequired:
api.BadRequest(c, err.Error())
default:
api.InternalError(c, "Failed to update budget")
}