Files
carvalho-finances/apps/api/internal/model/account.go
T
Mlcavalho1andClaude Sonnet 4.6 6292858970 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]>
2026-05-28 22:20:32 -03:00

28 lines
1.2 KiB
Go

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"
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"`
}
type AccountInput struct {
Name string `json:"name"`
Type string `json:"type"`
InitialBalance float64 `json:"initial_balance"`
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"`
}