Actually use files

This commit is contained in:
2022-04-05 20:33:04 +00:00
parent 9471c5b63b
commit bd99f58ab4
3 changed files with 38 additions and 12 deletions

View File

@ -59,8 +59,7 @@ func (h *Handler) budgetingForMonth(c *gin.Context) {
return
}
firstOfNextMonth := firstOfMonth.AddDate(0, 1, 0)
data, err := h.prepareBudgeting(c.Request.Context(), budget, firstOfNextMonth, firstOfMonth)
data, err := h.prepareBudgeting(c.Request.Context(), budget, firstOfMonth)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
@ -68,7 +67,8 @@ func (h *Handler) budgetingForMonth(c *gin.Context) {
c.JSON(http.StatusOK, data)
}
func (h *Handler) prepareBudgeting(ctx context.Context, budget postgres.Budget, firstOfNextMonth time.Time, firstOfMonth time.Time) (BudgetingForMonthResponse, error) {
func (h *Handler) prepareBudgeting(ctx context.Context, budget postgres.Budget, firstOfMonth time.Time) (BudgetingForMonthResponse, error) {
firstOfNextMonth := firstOfMonth.AddDate(0, 1, 0)
categories, err := h.Service.GetCategories(ctx, budget.ID)
if err != nil {
return BudgetingForMonthResponse{}, fmt.Errorf("error loading categories: %w", err)