feat(#37): módulo de cartão de crédito com faturas mensais

- Migration 011: closing_day/due_day em accounts + tabela credit_bills
- CreditBillService: cria/atualiza fatura corrente on-demand no GET /accounts
- Widget FATURA ATUAL no dashboard com total e botão PAGAR
- AccountsView: campos closing_day/due_day para contas credit + painel fatura
- Dashboard: current_bills lista faturas não pagas de todos os cartões

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-27 15:12:53 -03:00
co-authored by Claude Sonnet 4.6
parent ee6cd9f37e
commit e3b3433703
17 changed files with 530 additions and 29 deletions
+5
View File
@@ -8,6 +8,9 @@ type Account struct {
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"`
CurrentBill *CreditBill `json:"current_bill,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
@@ -17,4 +20,6 @@ type AccountInput struct {
Type string `json:"type"`
InitialBalance float64 `json:"initial_balance"`
YieldType string `json:"yield_type"` // "none" | "cdi" | "variable"
ClosingDay *int `json:"closing_day,omitempty"`
DueDay *int `json:"due_day,omitempty"`
}
+22
View File
@@ -0,0 +1,22 @@
package model
type CreditBill struct {
ID int `json:"id"`
AccountID int `json:"account_id"`
AccountName string `json:"account_name"`
PeriodStart string `json:"period_start"`
PeriodEnd string `json:"period_end"`
DueDate string `json:"due_date"`
Total float64 `json:"total"`
Paid bool `json:"paid"`
PaidAt *string `json:"paid_at,omitempty"`
PaymentAccountID *int `json:"payment_account_id,omitempty"`
}
type CreditBillInput struct {
AccountID int `json:"account_id"`
PeriodStart string `json:"period_start"`
PeriodEnd string `json:"period_end"`
DueDate string `json:"due_date"`
PaymentAccountID *int `json:"payment_account_id,omitempty"`
}
+1
View File
@@ -34,4 +34,5 @@ type DashboardData struct {
RecentTransactions []RecentTransaction `json:"recent_transactions"`
PendingRecurring int `json:"pending_recurring"`
PendingIncomeRecurrings []PendingIncome `json:"pending_income_recurrings"`
CurrentBills []CreditBill `json:"current_bills"`
}