Update handler and types.DbCard to accept and send new fields

This commit is contained in:
qowevisa 2024-11-20 21:00:17 +02:00
parent 4522d4450f
commit e1a46f5fc7
2 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,8 @@ var cardTransform func(inp *db.Card) types.DbCard = func(inp *db.Card) types.DbC
Balance: inp.Balance,
HaveCreditLine: inp.HaveCreditLine,
CreditLine: inp.CreditLine,
LastDigits: inp.LastDigits,
CurrencyID: inp.CurrencyID,
}
}
@ -82,6 +84,8 @@ func CardAdd(c *gin.Context) {
dst.Balance = src.Balance
dst.HaveCreditLine = src.HaveCreditLine
dst.CreditLine = src.CreditLine
dst.LastDigits = src.LastDigits
dst.CurrencyID = src.CurrencyID
})(c)
}
@ -107,6 +111,8 @@ func CardPutId(c *gin.Context) {
dst.Balance = src.Balance
dst.CreditLine = src.CreditLine
dst.HaveCreditLine = src.HaveCreditLine
dst.LastDigits = src.LastDigits
dst.CurrencyID = src.CurrencyID
},
cardTransform)(c)
}

View File

@ -29,6 +29,8 @@ type DbCard struct {
Balance uint64 `json:"balance" example:"1000"`
HaveCreditLine bool `json:"have_credit_line" example:"true"`
CreditLine uint64 `json:"credit_line" example:"500000"`
LastDigits string `json:"last_digits" example:"1111"`
CurrencyID uint `json:"currency_id" example:"1"`
}
type DbCategory struct {