Add Getter for on/offbudget accounts and remove from backend
This commit is contained in:
@ -9,10 +9,8 @@ import (
|
||||
)
|
||||
|
||||
type AlwaysNeededData struct {
|
||||
Budget postgres.Budget
|
||||
Accounts []postgres.GetAccountsWithBalanceRow
|
||||
OnBudgetAccounts []postgres.GetAccountsWithBalanceRow
|
||||
OffBudgetAccounts []postgres.GetAccountsWithBalanceRow
|
||||
Budget postgres.Budget
|
||||
Accounts []postgres.GetAccountsWithBalanceRow
|
||||
}
|
||||
|
||||
func (h *Handler) getImportantData(c *gin.Context) {
|
||||
@ -36,20 +34,9 @@ func (h *Handler) getImportantData(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var onBudgetAccounts, offBudgetAccounts []postgres.GetAccountsWithBalanceRow
|
||||
for _, account := range accounts {
|
||||
if account.OnBudget {
|
||||
onBudgetAccounts = append(onBudgetAccounts, account)
|
||||
} else {
|
||||
offBudgetAccounts = append(offBudgetAccounts, account)
|
||||
}
|
||||
}
|
||||
|
||||
base := AlwaysNeededData{
|
||||
Accounts: accounts,
|
||||
OnBudgetAccounts: onBudgetAccounts,
|
||||
OffBudgetAccounts: offBudgetAccounts,
|
||||
Budget: budget,
|
||||
Accounts: accounts,
|
||||
Budget: budget,
|
||||
}
|
||||
|
||||
c.Set("data", base)
|
||||
|
Reference in New Issue
Block a user