Add available balance
This commit is contained in:
@ -12,10 +12,11 @@ import (
|
||||
|
||||
type BudgetingData struct {
|
||||
AlwaysNeededData
|
||||
Categories []postgres.GetCategoriesWithBalanceRow
|
||||
Date time.Time
|
||||
Next time.Time
|
||||
Previous time.Time
|
||||
Categories []postgres.GetCategoriesWithBalanceRow
|
||||
AvailableBalance postgres.Numeric
|
||||
Date time.Time
|
||||
Next time.Time
|
||||
Previous time.Time
|
||||
}
|
||||
|
||||
func (h *Handler) budgeting(c *gin.Context) {
|
||||
@ -64,9 +65,16 @@ func (h *Handler) budgeting(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
availableBalance, err := h.Service.DB.GetAvailableBalance(c.Request.Context(), budgetUUID)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
d := BudgetingData{
|
||||
c.MustGet("data").(AlwaysNeededData),
|
||||
categories,
|
||||
availableBalance,
|
||||
firstOfMonth,
|
||||
firstOfNextMonth,
|
||||
firstOfPreviousMonth,
|
||||
|
Reference in New Issue
Block a user