feat: #44 fatura de cartão com data futura fica pendente até confirmação

- Nova tabela pending_bill_imports (migration 016)
- ImportHandler.Confirm: quando is_credit_card=true e payment_date > hoje,
  salva como pending em vez de inserir transações
- Novos endpoints: GET /pending-bills, POST /pending-bills/:id/confirm,
  DELETE /pending-bills/:id
- Dashboard inclui pending_bill_imports no payload
- Frontend: resultado "fatura salva como pendente" no ImportView
- AccountsView exibe widget de faturas pendentes com ações de confirmar/descartar
- dashboard_test: mock de PendingBillRepo + TransactionRepository

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-28 22:26:42 -03:00
co-authored by Claude Sonnet 4.6
parent 9742ae7469
commit 2b8524dcde
16 changed files with 453 additions and 32 deletions
+9 -2
View File
@@ -65,7 +65,10 @@ func main() {
transactionRepo := repository.NewTransactionRepository(pool)
importSvc := service.NewImportService(transactionRepo)
importHandler := handler.NewImportHandler(importSvc, gameSvc)
pendingBillRepo := repository.NewPendingBillRepository(pool)
pendingBillSvc := service.NewPendingBillService(pendingBillRepo, transactionRepo)
importHandler := handler.NewImportHandler(importSvc, gameSvc, pendingBillSvc)
pendingBillHandler := handler.NewPendingBillHandler(pendingBillSvc, gameSvc)
manualTxRepo := repository.NewManualTransactionRepository(pool)
txSvc := service.NewTransactionService(manualTxRepo)
@@ -84,7 +87,7 @@ func main() {
creditBillHandler := handler.NewCreditBillHandler(creditBillSvc)
dashboardRepo := repository.NewDashboardRepository(pool)
dashboardSvc := service.NewDashboardService(dashboardRepo, recurringSvc, accountRepo, creditBillSvc)
dashboardSvc := service.NewDashboardService(dashboardRepo, recurringSvc, accountRepo, creditBillSvc, pendingBillSvc)
dashboardHandler := handler.NewDashboardHandler(dashboardSvc)
r.Get("/health", handler.Health)
@@ -108,6 +111,10 @@ func main() {
r.Post("/imports/preview", importHandler.Preview)
r.Post("/imports/confirm", importHandler.Confirm)
r.Get("/pending-bills", pendingBillHandler.List)
r.Post("/pending-bills/{id}/confirm", pendingBillHandler.Confirm)
r.Delete("/pending-bills/{id}", pendingBillHandler.Discard)
r.Get("/transactions", txHandler.List)
r.Post("/transactions", txHandler.Create)
r.Put("/transactions/{id}", txHandler.Update)