Implement categories for new transactions

This commit is contained in:
2021-12-14 14:41:10 +00:00
parent 1ab1fa74e0
commit d0ad0dcb3a
5 changed files with 70 additions and 12 deletions

View File

@ -12,6 +12,7 @@ import (
type AllAccountsData struct {
AlwaysNeededData
Account *postgres.Account
Categories []postgres.GetCategoriesRow
Transactions []postgres.GetTransactionsForBudgetRow
}
@ -23,6 +24,12 @@ func (h *Handler) allAccounts(c *gin.Context) {
return
}
categories, err := h.Service.GetCategories(c.Request.Context(), budgetUUID)
if err != nil {
c.AbortWithError(http.StatusNotFound, err)
return
}
transactions, err := h.Service.GetTransactionsForBudget(c.Request.Context(), budgetUUID)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
@ -34,6 +41,7 @@ func (h *Handler) allAccounts(c *gin.Context) {
&postgres.Account{
Name: "All accounts",
},
categories,
transactions,
}