chore: replace int amount_cents for string storage and decimal pkg
This commit is contained in:
parent
13774eec7d
commit
c8a1eb5b7a
45 changed files with 706 additions and 587 deletions
|
|
@ -1,25 +1,30 @@
|
|||
package model
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type Loan struct {
|
||||
ID string `db:"id"`
|
||||
SpaceID string `db:"space_id"`
|
||||
Name string `db:"name"`
|
||||
Description string `db:"description"`
|
||||
OriginalAmountCents int `db:"original_amount_cents"`
|
||||
InterestRateBps int `db:"interest_rate_bps"`
|
||||
StartDate time.Time `db:"start_date"`
|
||||
EndDate *time.Time `db:"end_date"`
|
||||
IsPaidOff bool `db:"is_paid_off"`
|
||||
CreatedBy string `db:"created_by"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
ID string `db:"id"`
|
||||
SpaceID string `db:"space_id"`
|
||||
Name string `db:"name"`
|
||||
Description string `db:"description"`
|
||||
OriginalAmount decimal.Decimal `db:"original_amount"`
|
||||
OriginalAmountCents int `db:"original_amount_cents"` // deprecated: kept for SELECT * compatibility
|
||||
InterestRateBps int `db:"interest_rate_bps"`
|
||||
StartDate time.Time `db:"start_date"`
|
||||
EndDate *time.Time `db:"end_date"`
|
||||
IsPaidOff bool `db:"is_paid_off"`
|
||||
CreatedBy string `db:"created_by"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
type LoanWithPaymentSummary struct {
|
||||
Loan
|
||||
TotalPaidCents int
|
||||
RemainingCents int
|
||||
ReceiptCount int
|
||||
TotalPaid decimal.Decimal
|
||||
Remaining decimal.Decimal
|
||||
ReceiptCount int
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue