feat: payment methods
All checks were successful
Deploy / build-and-deploy (push) Successful in 1m1s

This commit is contained in:
juancwu 2026-02-13 21:55:10 +00:00
commit 3de76916c9
15 changed files with 946 additions and 100 deletions

View file

@ -10,15 +10,16 @@ const (
)
type Expense struct {
ID string `db:"id"`
SpaceID string `db:"space_id"`
CreatedBy string `db:"created_by"`
Description string `db:"description"`
AmountCents int `db:"amount_cents"`
Type ExpenseType `db:"type"`
Date time.Time `db:"date"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
ID string `db:"id"`
SpaceID string `db:"space_id"`
CreatedBy string `db:"created_by"`
Description string `db:"description"`
AmountCents int `db:"amount_cents"`
Type ExpenseType `db:"type"`
Date time.Time `db:"date"`
PaymentMethodID *string `db:"payment_method_id"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
type ExpenseWithTags struct {
@ -26,6 +27,12 @@ type ExpenseWithTags struct {
Tags []*Tag
}
type ExpenseWithTagsAndMethod struct {
Expense
Tags []*Tag
PaymentMethod *PaymentMethod
}
type ExpenseTag struct {
ExpenseID string `db:"expense_id"`
TagID string `db:"tag_id"`

View file

@ -0,0 +1,21 @@
package model
import "time"
type PaymentMethodType string
const (
PaymentMethodTypeCredit PaymentMethodType = "credit"
PaymentMethodTypeDebit PaymentMethodType = "debit"
)
type PaymentMethod struct {
ID string `db:"id"`
SpaceID string `db:"space_id"`
Name string `db:"name"`
Type PaymentMethodType `db:"type"`
LastFour *string `db:"last_four"`
CreatedBy string `db:"created_by"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}