feat: confirmar despesas recorrentes cria transação manual

Botão CONFIRMAR para despesas pendentes, igual ao fluxo de receitas.
Backend remove guard income-only no ConfirmIncome.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-27 15:45:17 -03:00
co-authored by Claude Sonnet 4.6
parent 5c55da8a4a
commit 7282109206
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -110,21 +110,22 @@ func (s *RecurringService) MonthlyStatus(ctx context.Context, month string) ([]m
return result, nil
}
// ConfirmIncome creates an income transaction confirming receipt of this recurring income.
// ConfirmIncome creates a transaction (income or expense) confirming this recurring item for the month.
func (s *RecurringService) ConfirmIncome(ctx context.Context, id int, month string) error {
re, err := s.repo.GetByID(ctx, id)
if err != nil {
return err
}
if re.Type != "income" {
return ErrRecurringNotIncome
txType := re.Type
if txType == "" {
txType = "expense"
}
today := time.Now().Format("2006-01-02")
tx := model.Transaction{
Date: today,
Amount: re.ExpectedAmount,
Description: re.Name,
Type: "income",
Type: txType,
CategoryID: re.CategoryID,
}
_, err = s.txRepo.Create(ctx, tx)