26 lines
622 B
Go
Raw Normal View History

2025-01-25 18:33:11 +08:00
package models
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
2025-01-26 19:51:35 +08:00
"git.solsynth.dev/hypernet/wallet/pkg/proto"
2025-01-25 18:33:11 +08:00
"github.com/shopspring/decimal"
)
type Wallet struct {
cruda.BaseModel
Transactions []Transaction `json:"transactions"`
Balance decimal.Decimal `json:"amount" sql:"type:decimal(30,2);"`
2025-01-26 19:51:35 +08:00
Password string `json:"password"`
2025-01-25 18:33:11 +08:00
AccountID uint `json:"account_id"`
}
2025-01-26 19:51:35 +08:00
func (v *Wallet) ToWalletInfo() *proto.WalletInfo {
balance, _ := v.Balance.Float64()
return &proto.WalletInfo{
Id: uint64(v.ID),
Balance: balance,
AccountId: uint64(v.AccountID),
}
}