Compare commits
5 Commits
e1a46f5fc7
...
957f1e8363
Author | SHA1 | Date | |
---|---|---|---|
957f1e8363 | |||
0f7b1b210a | |||
4db167085a | |||
4fc2b5f5bd | |||
4199603be3 |
145
db/transfer.go
145
db/transfer.go
|
@ -14,6 +14,9 @@ type Transfer struct {
|
||||||
ToCardID uint
|
ToCardID uint
|
||||||
ToCard *Card
|
ToCard *Card
|
||||||
Value uint64
|
Value uint64
|
||||||
|
HaveDifferentCurrencies bool
|
||||||
|
FromValue uint64
|
||||||
|
ToValue uint64
|
||||||
Date time.Time
|
Date time.Time
|
||||||
UserID uint
|
UserID uint
|
||||||
User *User
|
User *User
|
||||||
|
@ -36,34 +39,65 @@ func (t *Transfer) SetUserID(id uint) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ERROR_TRANSFER_FROMCARD_INVALID_USERID = errors.New("Transfer's UserID and FromCard's UserID are not equal")
|
ERROR_TRANSFER_FROMCARD_INVALID_USERID = errors.New("Transfer's UserID and FromCard's UserID are not equal")
|
||||||
ERROR_TRANSFER_FROMCARD_INSUFFICIENT_BALANCE = errors.New("FromCard's Balance is lower than Transfer's Value")
|
ERROR_TRANSFER_FROMCARD_INSUFFICIENT_BALANCE = errors.New("FromCard's Balance is lower than Transfer's Value or FromValue")
|
||||||
ERROR_TRANSFER_TOCARD_INVALID_USERID = errors.New("Transfer's UserID and ToCard's UserID are not equal")
|
ERROR_TRANSFER_TOCARD_INVALID_USERID = errors.New("Transfer's UserID and ToCard's UserID are not equal")
|
||||||
|
ERROR_TRANSFER_CURRENCY_INCOSISTENCE = errors.New("Transfer is using differenct currencies but FromValue or ToValue is not set approprietly")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (t *Transfer) validateTransfer(fromCard, toCard *Card) error {
|
||||||
|
if fromCard.UserID != t.UserID {
|
||||||
|
return ERROR_TRANSFER_FROMCARD_INVALID_USERID
|
||||||
|
}
|
||||||
|
if toCard.UserID != t.UserID {
|
||||||
|
return ERROR_TRANSFER_TOCARD_INVALID_USERID
|
||||||
|
}
|
||||||
|
diffCurs := fromCard.CurrencyID != toCard.CurrencyID
|
||||||
|
if diffCurs && (t.FromValue == 0 || t.ToValue == 0) {
|
||||||
|
return ERROR_TRANSFER_CURRENCY_INCOSISTENCE
|
||||||
|
}
|
||||||
|
if !diffCurs && fromCard.Balance < t.Value {
|
||||||
|
return ERROR_TRANSFER_FROMCARD_INSUFFICIENT_BALANCE
|
||||||
|
}
|
||||||
|
if diffCurs && fromCard.Balance < t.FromValue {
|
||||||
|
return ERROR_TRANSFER_FROMCARD_INSUFFICIENT_BALANCE
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Transfer) BeforeCreate(tx *gorm.DB) error {
|
func (t *Transfer) BeforeCreate(tx *gorm.DB) error {
|
||||||
fromCard := &Card{}
|
fromCard := &Card{}
|
||||||
if err := tx.Find(fromCard, t.FromCardID).Error; err != nil {
|
if err := tx.Find(fromCard, t.FromCardID).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if fromCard.UserID != t.UserID {
|
toCard := &Card{}
|
||||||
return ERROR_TRANSFER_FROMCARD_INVALID_USERID
|
if err := tx.Find(toCard, t.ToCardID).Error; err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
if fromCard.Balance < t.Value {
|
if err := t.validateTransfer(fromCard, toCard); err != nil {
|
||||||
return ERROR_TRANSFER_FROMCARD_INSUFFICIENT_BALANCE
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.HaveDifferentCurrencies = fromCard.CurrencyID != toCard.CurrencyID
|
||||||
|
// on same CurrencyID fromCard and toCard should use Value
|
||||||
|
if !t.HaveDifferentCurrencies {
|
||||||
fromCard.Balance -= t.Value
|
fromCard.Balance -= t.Value
|
||||||
if err := tx.Save(fromCard).Error; err != nil {
|
if err := tx.Save(fromCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
toCard := &Card{}
|
toCard.Balance += t.Value
|
||||||
if err := tx.Find(toCard, t.ToCardID).Error; err != nil {
|
if err := tx.Save(toCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if toCard.UserID != t.UserID {
|
return nil
|
||||||
return ERROR_TRANSFER_TOCARD_INVALID_USERID
|
|
||||||
}
|
}
|
||||||
toCard.Balance += t.Value
|
// on DIFFERENT CurrencyID fromCard should use FromValue and toCard should use ToValue
|
||||||
|
fromCard.Balance -= t.FromValue
|
||||||
|
if err := tx.Save(fromCard).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
//
|
||||||
|
toCard.Balance += t.ToValue
|
||||||
if err := tx.Save(toCard).Error; err != nil {
|
if err := tx.Save(toCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -71,39 +105,43 @@ func (t *Transfer) BeforeCreate(tx *gorm.DB) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ERROR_TRANSFER_FROMCARD_IDZERO = errors.New("Transfer's FromCardID is zero")
|
ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE = errors.New("Transfer's ToCard's Balance is lower than Value of ToValue of transfer")
|
||||||
ERROR_TRANSFER_TOCARD_IDZERO = errors.New("Transfer's ToCardID is zero")
|
|
||||||
ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE = errors.New("Transfer's ToCard's Balance is lower than value of transfer")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (t *Transfer) BeforeUpdate(tx *gorm.DB) error {
|
func (t *Transfer) BeforeUpdate(tx *gorm.DB) error {
|
||||||
var original Transfer
|
var original *Transfer
|
||||||
if err := tx.Find(&original, t.ID).Error; err != nil {
|
if err := tx.Find(original, t.ID).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if original.FromCardID == 0 {
|
var origFromCard *Card
|
||||||
return ERROR_TRANSFER_FROMCARD_IDZERO
|
if err := tx.Find(origFromCard, original.FromCardID).Error; err != nil {
|
||||||
}
|
|
||||||
var origFromCard Card
|
|
||||||
if err := tx.Find(&origFromCard, original.FromCardID).Error; err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
origFromCard.Balance += original.Value
|
var origToCard *Card
|
||||||
if err := tx.Save(origFromCard).Error; err != nil {
|
if err := tx.Find(origToCard, original.ToCardID).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if original.ToCardID == 0 {
|
diffCurs := origFromCard.CurrencyID != origToCard.CurrencyID
|
||||||
return ERROR_TRANSFER_FROMCARD_IDZERO
|
if !diffCurs {
|
||||||
}
|
origFromCard.Balance += original.Value
|
||||||
var origToCard Card
|
|
||||||
if err := tx.Find(&origToCard, original.ToCardID).Error; err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if origToCard.Balance < original.Value {
|
if origToCard.Balance < original.Value {
|
||||||
return ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE
|
return ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE
|
||||||
}
|
}
|
||||||
origToCard.Balance -= original.Value
|
origToCard.Balance -= original.Value
|
||||||
|
} else {
|
||||||
|
if original.FromValue == 0 || original.ToValue == 0 {
|
||||||
|
return ERROR_TRANSFER_CURRENCY_INCOSISTENCE
|
||||||
|
}
|
||||||
|
origFromCard.Balance += original.FromValue
|
||||||
|
if origToCard.Balance < original.ToValue {
|
||||||
|
return ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE
|
||||||
|
}
|
||||||
|
origToCard.Balance -= original.ToValue
|
||||||
|
}
|
||||||
|
if err := tx.Save(origFromCard).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := tx.Save(origToCard).Error; err != nil {
|
if err := tx.Save(origToCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -112,25 +150,35 @@ func (t *Transfer) BeforeUpdate(tx *gorm.DB) error {
|
||||||
if err := tx.Find(fromCard, t.FromCardID).Error; err != nil {
|
if err := tx.Find(fromCard, t.FromCardID).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if fromCard.UserID != t.UserID {
|
toCard := &Card{}
|
||||||
return ERROR_TRANSFER_FROMCARD_INVALID_USERID
|
if err := tx.Find(toCard, t.ToCardID).Error; err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
if fromCard.Balance < t.Value {
|
if err := t.validateTransfer(fromCard, toCard); err != nil {
|
||||||
return ERROR_TRANSFER_FROMCARD_INSUFFICIENT_BALANCE
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.HaveDifferentCurrencies = fromCard.CurrencyID != toCard.CurrencyID
|
||||||
|
// on same CurrencyID fromCard and toCard should use Value
|
||||||
|
if !t.HaveDifferentCurrencies {
|
||||||
fromCard.Balance -= t.Value
|
fromCard.Balance -= t.Value
|
||||||
if err := tx.Save(fromCard).Error; err != nil {
|
if err := tx.Save(fromCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
toCard := &Card{}
|
toCard.Balance += t.Value
|
||||||
if err := tx.Find(toCard, t.ToCardID).Error; err != nil {
|
if err := tx.Save(toCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if toCard.UserID != t.UserID {
|
return nil
|
||||||
return ERROR_TRANSFER_TOCARD_INVALID_USERID
|
|
||||||
}
|
}
|
||||||
toCard.Balance += t.Value
|
// on DIFFERENT CurrencyID fromCard should use FromValue and toCard should use ToValue
|
||||||
|
fromCard.Balance -= t.FromValue
|
||||||
|
if err := tx.Save(fromCard).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
//
|
||||||
|
toCard.Balance += t.ToValue
|
||||||
if err := tx.Save(toCard).Error; err != nil {
|
if err := tx.Save(toCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -142,18 +190,31 @@ func (t *Transfer) AfterDelete(tx *gorm.DB) error {
|
||||||
if err := tx.Find(fromCard, t.FromCardID).Error; err != nil {
|
if err := tx.Find(fromCard, t.FromCardID).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fromCard.Balance += t.Value
|
|
||||||
if err := tx.Save(fromCard).Error; err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
toCard := &Card{}
|
toCard := &Card{}
|
||||||
if err := tx.Find(toCard, t.ToCardID).Error; err != nil {
|
if err := tx.Find(toCard, t.ToCardID).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
diffCurs := fromCard.CurrencyID != toCard.CurrencyID
|
||||||
|
if !diffCurs {
|
||||||
|
fromCard.Balance += t.Value
|
||||||
if toCard.Balance < t.Value {
|
if toCard.Balance < t.Value {
|
||||||
return ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE
|
return ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE
|
||||||
}
|
}
|
||||||
toCard.Balance -= t.Value
|
toCard.Balance -= t.Value
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
if t.FromValue == 0 || t.ToValue == 0 {
|
||||||
|
return ERROR_TRANSFER_CURRENCY_INCOSISTENCE
|
||||||
|
}
|
||||||
|
fromCard.Balance += t.FromValue
|
||||||
|
if toCard.Balance < t.ToValue {
|
||||||
|
return ERROR_TRANSFER_TOCARD_INSUFFICIENT_BALANCE
|
||||||
|
}
|
||||||
|
toCard.Balance -= t.ToValue
|
||||||
|
}
|
||||||
|
if err := tx.Save(fromCard).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := tx.Save(toCard).Error; err != nil {
|
if err := tx.Save(toCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"git.qowevisa.me/Qowevisa/fin-check-api/db"
|
"git.qowevisa.me/Qowevisa/fin-check-api/db"
|
||||||
"git.qowevisa.me/Qowevisa/fin-check-api/types"
|
"git.qowevisa.me/Qowevisa/fin-check-api/types"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cardTransform func(inp *db.Card) types.DbCard = func(inp *db.Card) types.DbCard {
|
var cardTransform func(inp *db.Card) types.DbCard = func(inp *db.Card) types.DbCard {
|
||||||
|
var curr types.DbCurrency
|
||||||
|
if inp.Currency != nil {
|
||||||
|
curr = currencyTransform(inp.Currency)
|
||||||
|
} else {
|
||||||
|
curr = types.DbCurrency{}
|
||||||
|
}
|
||||||
return types.DbCard{
|
return types.DbCard{
|
||||||
ID: inp.ID,
|
ID: inp.ID,
|
||||||
Name: inp.Name,
|
Name: inp.Name,
|
||||||
|
@ -15,6 +25,8 @@ var cardTransform func(inp *db.Card) types.DbCard = func(inp *db.Card) types.DbC
|
||||||
CreditLine: inp.CreditLine,
|
CreditLine: inp.CreditLine,
|
||||||
LastDigits: inp.LastDigits,
|
LastDigits: inp.LastDigits,
|
||||||
CurrencyID: inp.CurrencyID,
|
CurrencyID: inp.CurrencyID,
|
||||||
|
Currency: curr,
|
||||||
|
DisplayName: fmt.Sprintf("%s •%s", inp.Name, inp.LastDigits),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +63,20 @@ func CardGetAll(c *gin.Context) {
|
||||||
c.JSON(500, types.ErrorResponse{Message: err.Error()})
|
c.JSON(500, types.ErrorResponse{Message: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
preloadCurrencies := c.DefaultQuery("preload_currencies", "false")
|
||||||
|
shouldPreloadCurrencies := false
|
||||||
|
if val, err := strconv.ParseBool(preloadCurrencies); err == nil {
|
||||||
|
shouldPreloadCurrencies = val
|
||||||
|
}
|
||||||
dbc := db.Connect()
|
dbc := db.Connect()
|
||||||
var entities []*db.Card
|
var entities []*db.Card
|
||||||
if err := dbc.Find(&entities, db.Card{UserID: userID}).Error; err != nil {
|
var tx *gorm.DB
|
||||||
|
if shouldPreloadCurrencies {
|
||||||
|
tx = dbc.Preload("Currency")
|
||||||
|
} else {
|
||||||
|
tx = dbc
|
||||||
|
}
|
||||||
|
if err := tx.Find(&entities, db.Card{UserID: userID}).Error; err != nil {
|
||||||
c.JSON(500, types.ErrorResponse{Message: err.Error()})
|
c.JSON(500, types.ErrorResponse{Message: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,52 @@
|
||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.qowevisa.me/Qowevisa/fin-check-api/db"
|
"git.qowevisa.me/Qowevisa/fin-check-api/db"
|
||||||
"git.qowevisa.me/Qowevisa/fin-check-api/types"
|
"git.qowevisa.me/Qowevisa/fin-check-api/types"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
var transferTransform func(inp *db.Transfer) types.DbTransfer = func(inp *db.Transfer) types.DbTransfer {
|
var transferTransform func(inp *db.Transfer) types.DbTransfer = func(inp *db.Transfer) types.DbTransfer {
|
||||||
|
var fromCard types.DbCard
|
||||||
|
var toCard types.DbCard
|
||||||
|
if inp.FromCard != nil {
|
||||||
|
fromCard = cardTransform(inp.FromCard)
|
||||||
|
}
|
||||||
|
if inp.ToCard != nil {
|
||||||
|
toCard = cardTransform(inp.ToCard)
|
||||||
|
}
|
||||||
|
haveDiffCurrs := false
|
||||||
|
if inp.FromCard != nil && inp.FromCard.Currency != nil && inp.ToCard != nil && inp.ToCard.Currency != nil {
|
||||||
|
haveDiffCurrs = inp.FromCard.CurrencyID != inp.ToCard.CurrencyID
|
||||||
|
}
|
||||||
|
var showValue string
|
||||||
|
if haveDiffCurrs {
|
||||||
|
showValue = fmt.Sprintf("%d.%02d%s -> %d.%02d%s",
|
||||||
|
inp.FromValue/100,
|
||||||
|
inp.FromValue%100,
|
||||||
|
inp.FromCard.Currency.Symbol,
|
||||||
|
inp.ToValue/100,
|
||||||
|
inp.ToValue%100,
|
||||||
|
inp.ToCard.Currency.Symbol,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
showValue = fmt.Sprintf("%d.%02d", inp.Value/100, inp.Value%100)
|
||||||
|
}
|
||||||
return types.DbTransfer{
|
return types.DbTransfer{
|
||||||
ID: inp.ID,
|
ID: inp.ID,
|
||||||
FromCardID: inp.FromCardID,
|
FromCardID: inp.FromCardID,
|
||||||
ToCardID: inp.ToCardID,
|
ToCardID: inp.ToCardID,
|
||||||
Value: inp.Value,
|
Value: inp.Value,
|
||||||
|
FromValue: inp.FromValue,
|
||||||
|
ToValue: inp.ToValue,
|
||||||
Date: inp.Date,
|
Date: inp.Date,
|
||||||
|
//
|
||||||
|
ShowValue: showValue,
|
||||||
|
HaveDifferentCurrencies: haveDiffCurrs,
|
||||||
|
FromCard: fromCard,
|
||||||
|
ToCard: toCard,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +86,7 @@ func TransferGetAll(c *gin.Context) {
|
||||||
}
|
}
|
||||||
dbc := db.Connect()
|
dbc := db.Connect()
|
||||||
var entities []*db.Transfer
|
var entities []*db.Transfer
|
||||||
if err := dbc.Find(&entities, db.Transfer{UserID: userID}).Error; err != nil {
|
if err := dbc.Preload("FromCard.Currency").Preload("ToCard.Currency").Find(&entities, db.Transfer{UserID: userID}).Error; err != nil {
|
||||||
c.JSON(500, types.ErrorResponse{Message: err.Error()})
|
c.JSON(500, types.ErrorResponse{Message: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -82,6 +116,8 @@ func TransferAdd(c *gin.Context) {
|
||||||
dst.ToCardID = src.ToCardID
|
dst.ToCardID = src.ToCardID
|
||||||
dst.Value = src.Value
|
dst.Value = src.Value
|
||||||
dst.Date = src.Date
|
dst.Date = src.Date
|
||||||
|
dst.FromValue = src.FromValue
|
||||||
|
dst.ToValue = src.ToValue
|
||||||
})(c)
|
})(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +143,8 @@ func TransferPutId(c *gin.Context) {
|
||||||
dst.ToCardID = src.ToCardID
|
dst.ToCardID = src.ToCardID
|
||||||
dst.Value = src.Value
|
dst.Value = src.Value
|
||||||
dst.Date = src.Date
|
dst.Date = src.Date
|
||||||
|
dst.FromValue = src.FromValue
|
||||||
|
dst.ToValue = src.ToValue
|
||||||
},
|
},
|
||||||
transferTransform,
|
transferTransform,
|
||||||
)(c)
|
)(c)
|
||||||
|
|
|
@ -31,6 +31,9 @@ type DbCard struct {
|
||||||
CreditLine uint64 `json:"credit_line" example:"500000"`
|
CreditLine uint64 `json:"credit_line" example:"500000"`
|
||||||
LastDigits string `json:"last_digits" example:"1111"`
|
LastDigits string `json:"last_digits" example:"1111"`
|
||||||
CurrencyID uint `json:"currency_id" example:"1"`
|
CurrencyID uint `json:"currency_id" example:"1"`
|
||||||
|
Currency DbCurrency `json:"currency"`
|
||||||
|
// Purely UI things
|
||||||
|
DisplayName string `json:"display_name" example:"CreditCard •4444"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DbCategory struct {
|
type DbCategory struct {
|
||||||
|
@ -86,7 +89,14 @@ type DbTransfer struct {
|
||||||
FromCardID uint `json:"from_card_id" example:"1"`
|
FromCardID uint `json:"from_card_id" example:"1"`
|
||||||
ToCardID uint `json:"to_card_id" example:"1"`
|
ToCardID uint `json:"to_card_id" example:"1"`
|
||||||
Value uint64 `json:"value" example:"20000"`
|
Value uint64 `json:"value" example:"20000"`
|
||||||
|
FromValue uint64 `json:"from_value" example:"20000"`
|
||||||
|
ToValue uint64 `json:"to_value" example:"20000"`
|
||||||
Date time.Time `json:"date" example:"29/11/2001 12:00"`
|
Date time.Time `json:"date" example:"29/11/2001 12:00"`
|
||||||
|
// Purely UI things
|
||||||
|
ShowValue string `json:"show_value" example:"10.35$"`
|
||||||
|
HaveDifferentCurrencies bool `json:"have_diff_currs" example:"false"`
|
||||||
|
FromCard DbCard `json:"from_card"`
|
||||||
|
ToCard DbCard `json:"to_card"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DbItem struct {
|
type DbItem struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user