chore: replace int amount_cents for string storage and decimal pkg

This commit is contained in:
juancwu 2026-03-14 14:43:39 -04:00
commit c8a1eb5b7a
No known key found for this signature in database
45 changed files with 706 additions and 587 deletions

View file

@ -1,6 +1,10 @@
package model
import "time"
import (
"time"
"github.com/shopspring/decimal"
)
type TransferDirection string
@ -21,7 +25,8 @@ type MoneyAccount struct {
type AccountTransfer struct {
ID string `db:"id"`
AccountID string `db:"account_id"`
AmountCents int `db:"amount_cents"`
Amount decimal.Decimal `db:"amount"`
AmountCents int `db:"amount_cents"` // deprecated: kept for SELECT * compatibility
Direction TransferDirection `db:"direction"`
Note string `db:"note"`
RecurringDepositID *string `db:"recurring_deposit_id"`
@ -31,7 +36,7 @@ type AccountTransfer struct {
type MoneyAccountWithBalance struct {
MoneyAccount
BalanceCents int
Balance decimal.Decimal
}
type AccountTransferWithAccount struct {