feat: salvar data original da transação e data de vencimento no cartão

Ao importar fatura de cartão com PaymentDate configurado, a data efetiva
da transação passa a ser o vencimento e a data de compra é preservada em
original_date. Migration 013 adiciona a coluna original_date em transactions.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-27 16:25:52 -03:00
co-authored by Claude Sonnet 4.6
parent 9ba3a3678b
commit 2b0aa352d5
7 changed files with 40 additions and 15 deletions
+9 -7
View File
@@ -17,13 +17,14 @@ type Transaction struct {
// ImportRow is a parsed-but-not-yet-saved transaction from a file.
type ImportRow struct {
Date string `json:"date"`
Amount float64 `json:"amount"`
Description string `json:"description"`
Type string `json:"type"`
CategoryID *int `json:"category_id,omitempty"`
ExternalID string `json:"external_id,omitempty"` // FITID from OFX
IsDuplicate bool `json:"is_duplicate"`
Date string `json:"date"` // effective date (payment date for credit cards)
OriginalDate string `json:"original_date"` // purchase date from the CSV (empty for non-credit imports)
Amount float64 `json:"amount"`
Description string `json:"description"`
Type string `json:"type"`
CategoryID *int `json:"category_id,omitempty"`
ExternalID string `json:"external_id,omitempty"` // FITID from OFX
IsDuplicate bool `json:"is_duplicate"`
}
// ImportResult is the response after confirming an import.
@@ -44,4 +45,5 @@ type CSVMapping struct {
FieldSeparator string `json:"field_separator"` // "," or ";"
SkipNegative bool `json:"skip_negative"` // skip rows with negative amount (e.g. credit card bill payments)
AllExpenses bool `json:"all_expenses"` // treat all rows as expense (credit card statements)
PaymentDate string `json:"payment_date"` // YYYY-MM-DD; when set, overrides date for all rows (credit card due date)
}