Implement categories for new transactions
This commit is contained in:
@ -11,10 +11,13 @@ import (
|
||||
type AccountData struct {
|
||||
AlwaysNeededData
|
||||
Account *postgres.Account
|
||||
Categories []postgres.GetCategoriesRow
|
||||
Transactions []postgres.GetTransactionsForAccountRow
|
||||
}
|
||||
|
||||
func (h *Handler) account(c *gin.Context) {
|
||||
data := c.MustGet("data").(AlwaysNeededData)
|
||||
|
||||
accountID := c.Param("accountid")
|
||||
accountUUID, err := uuid.Parse(accountID)
|
||||
if err != nil {
|
||||
@ -28,6 +31,12 @@ func (h *Handler) account(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
categories, err := h.Service.GetCategories(c.Request.Context(), data.Budget.ID)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusNotFound, err)
|
||||
return
|
||||
}
|
||||
|
||||
transactions, err := h.Service.GetTransactionsForAccount(c.Request.Context(), accountUUID)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusNotFound, err)
|
||||
@ -35,8 +44,9 @@ func (h *Handler) account(c *gin.Context) {
|
||||
}
|
||||
|
||||
d := AccountData{
|
||||
c.MustGet("data").(AlwaysNeededData),
|
||||
data,
|
||||
&account,
|
||||
categories,
|
||||
transactions,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user