feat: categorizar transações no preview de importação

Select de categoria em cada linha da prévia; category_id salvo no
BulkInsert. Duplicatas ficam desabilitadas.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-27 16:04:19 -03:00
co-authored by Claude Sonnet 4.6
parent 54d5a03604
commit 482bae698a
4 changed files with 27 additions and 4 deletions
+1
View File
@@ -21,6 +21,7 @@ type ImportRow struct {
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"`
}
+3 -3
View File
@@ -63,9 +63,9 @@ func (r *transactionRepo) BulkInsert(ctx context.Context, rows []model.ImportRow
extID = &row.ExternalID
}
_, err := tx.Exec(ctx, `
INSERT INTO transactions (date, amount, description, type, source, external_id)
VALUES ($1, $2, $3, $4, 'import', $5)`,
row.Date, row.Amount, row.Description, row.Type, extID)
INSERT INTO transactions (date, amount, description, type, source, external_id, category_id)
VALUES ($1, $2, $3, $4, 'import', $5, $6)`,
row.Date, row.Amount, row.Description, row.Type, extID, row.CategoryID)
if err != nil {
return count, err
}