feat: CDI % configurável por conta + fix mocks de teste

- Adiciona campo cdi_percentage (default 100%) na tabela accounts
- Cálculo CDI aplica proporção: balance × (compound-1) × (pct/100)
- Frontend exibe input de % quando yield_type=cdi e badge mostra valor
- Corrige mocks de teste desatualizados (DeleteByMonth, isTax)
- Corrige ConfirmIncome para rejeitar tipo expense (ErrRecurringNotIncome)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-28 22:20:32 -03:00
co-authored by Claude Sonnet 4.6
parent 433c4f42a5
commit 6292858970
10 changed files with 73 additions and 37 deletions
+14 -12
View File
@@ -1,25 +1,27 @@
package model
type Account struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
InitialBalance float64 `json:"initial_balance"`
Balance float64 `json:"balance"`
YieldType string `json:"yield_type"` // "none" | "cdi" | "variable"
LastYieldDate *string `json:"last_yield_date,omitempty"`
ClosingDay *int `json:"closing_day,omitempty"`
DueDay *int `json:"due_day,omitempty"`
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
InitialBalance float64 `json:"initial_balance"`
Balance float64 `json:"balance"`
YieldType string `json:"yield_type"` // "none" | "cdi" | "variable"
CDIPercentage float64 `json:"cdi_percentage"` // % do CDI que a conta rende (default 100)
LastYieldDate *string `json:"last_yield_date,omitempty"`
ClosingDay *int `json:"closing_day,omitempty"`
DueDay *int `json:"due_day,omitempty"`
CurrentBill *CreditBill `json:"current_bill,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type AccountInput struct {
Name string `json:"name"`
Type string `json:"type"`
InitialBalance float64 `json:"initial_balance"`
YieldType string `json:"yield_type"` // "none" | "cdi" | "variable"
YieldType string `json:"yield_type"` // "none" | "cdi" | "variable"
CDIPercentage float64 `json:"cdi_percentage"` // % do CDI (default 100)
ClosingDay *int `json:"closing_day,omitempty"`
DueDay *int `json:"due_day,omitempty"`
}