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]>
This commit is contained in:
@@ -58,11 +58,27 @@ func (s *DashboardService) Get(ctx context.Context, month string) (*model.Dashbo
|
||||
return nil, err
|
||||
}
|
||||
pending := 0
|
||||
for _, s := range statuses {
|
||||
if !s.Covered {
|
||||
pending++
|
||||
var pendingIncome []model.PendingIncome
|
||||
for _, st := range statuses {
|
||||
if st.Type == "income" {
|
||||
if !st.Covered {
|
||||
pendingIncome = append(pendingIncome, model.PendingIncome{
|
||||
ID: st.ID,
|
||||
Name: st.Name,
|
||||
ExpectedAmount: st.ExpectedAmount,
|
||||
DayOfMonth: st.DayOfMonth,
|
||||
Late: st.Late,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if !st.Covered {
|
||||
pending++
|
||||
}
|
||||
}
|
||||
}
|
||||
if pendingIncome == nil {
|
||||
pendingIncome = []model.PendingIncome{}
|
||||
}
|
||||
|
||||
if byCategory == nil {
|
||||
byCategory = []model.CategoryTotal{}
|
||||
@@ -80,14 +96,15 @@ func (s *DashboardService) Get(ctx context.Context, month string) (*model.Dashbo
|
||||
}
|
||||
|
||||
return &model.DashboardData{
|
||||
Month: month,
|
||||
TotalIncome: income,
|
||||
TotalExpenses: expenses,
|
||||
SavingsPct: savingsPct,
|
||||
TotalPatrimony: patrimony,
|
||||
ByCategory: byCategory,
|
||||
MonthlyEvolution: evolution,
|
||||
RecentTransactions: recent,
|
||||
PendingRecurring: pending,
|
||||
Month: month,
|
||||
TotalIncome: income,
|
||||
TotalExpenses: expenses,
|
||||
SavingsPct: savingsPct,
|
||||
TotalPatrimony: patrimony,
|
||||
ByCategory: byCategory,
|
||||
MonthlyEvolution: evolution,
|
||||
RecentTransactions: recent,
|
||||
PendingRecurring: pending,
|
||||
PendingIncomeRecurrings: pendingIncome,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user