Files
carvalho-finances/apps/api/internal/model/recurring.go
T
Mlcavalho1andClaude Sonnet 4.6 79f4a62a1b feat(#36): receitas recorrentes com confirmação de salário até dia 5
- Migration 009: coluna `type` em recurring_expenses + tabela recurring_late
- API Go: tipo income/expense em CRUD; endpoints POST /confirm e /late
- Dashboard: campo pending_income_recurrings na resposta
- Frontend: RecurringView com seções RECEITAS e DESPESAS separadas
- HomeView: widget de confirmação (dia 1-5) e badge SALÁRIO PENDENTE (pós dia 5)
- Testes unitários: 4 novos casos (income covered, late, confirm, reject expense)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-05-27 15:00:28 -03:00

42 lines
1.5 KiB
Go

package model
import "time"
type RecurringExpense struct {
ID int `json:"id"`
Name string `json:"name"`
ExpectedAmount float64 `json:"expected_amount"`
DayOfMonth int `json:"day_of_month"`
CategoryID *int `json:"category_id"`
Type string `json:"type"` // "income" | "expense"
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type RecurringInput struct {
Name string `json:"name"`
ExpectedAmount float64 `json:"expected_amount"`
DayOfMonth int `json:"day_of_month"`
CategoryID *int `json:"category_id"`
Type string `json:"type"` // "income" | "expense"
}
// RecurringStatus reports whether a recurring item is covered/ignored/late for a month.
type RecurringStatus struct {
RecurringExpense
Covered bool `json:"covered"` // has a matching transaction or was ignored
Ignored bool `json:"ignored"` // user explicitly ignored this month (expense)
Late bool `json:"late"` // user marked income as late this month
Reason string `json:"reason,omitempty"`
}
// PendingIncome is a lightweight summary of an income recurring pending confirmation.
type PendingIncome struct {
ID int `json:"id"`
Name string `json:"name"`
ExpectedAmount float64 `json:"expected_amount"`
DayOfMonth int `json:"day_of_month"`
Late bool `json:"late"`
}