feat(#18): import de extratos OFX e CSV — parser, dedup, preview e confirmação
Parser OFX tolerante ao formato SGML de bancos brasileiros (sem closing tags, BOM, timezone suffix). Parser CSV com separador de campo/decimal configurável. Dedup por FITID (OFX) ou date+amount+desc normalizado. Fluxo: POST /preview → revisão na UI → POST /confirm salva e loga. Migration 002 adiciona external_id com unique index. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -9,11 +9,22 @@ import (
|
||||
)
|
||||
|
||||
//go:embed sql/001_initial.sql
|
||||
var initial string
|
||||
var m001 string
|
||||
|
||||
//go:embed sql/002_add_external_id.sql
|
||||
var m002 string
|
||||
|
||||
func Run(ctx context.Context, pool *pgxpool.Pool) error {
|
||||
if _, err := pool.Exec(ctx, initial); err != nil {
|
||||
return fmt.Errorf("001_initial: %w", err)
|
||||
for i, sql := range []struct {
|
||||
version int
|
||||
sql string
|
||||
}{
|
||||
{1, m001},
|
||||
{2, m002},
|
||||
} {
|
||||
if _, err := pool.Exec(ctx, sql.sql); err != nil {
|
||||
return fmt.Errorf("migration %03d: %w", i+1, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user