Change db.Card.Value to db.Card.Balance and types.DbCard.Value to types.DbCard.Balance

This commit is contained in:
qowevisa 2024-11-01 09:26:37 +02:00
parent 340b39c35e
commit de7926337a
3 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,7 @@ import (
type Card struct { type Card struct {
gorm.Model gorm.Model
Name string Name string
Value uint64 Balance uint64
HaveCreditLine bool HaveCreditLine bool
CreditLine uint64 CreditLine uint64
UserID uint UserID uint

View File

@ -24,7 +24,7 @@ func CardGetId(c *gin.Context) {
return types.DbCard{ return types.DbCard{
ID: inp.ID, ID: inp.ID,
Name: inp.Name, Name: inp.Name,
Value: inp.Value, Balance: inp.Balance,
HaveCreditLine: inp.HaveCreditLine, HaveCreditLine: inp.HaveCreditLine,
CreditLine: inp.CreditLine, CreditLine: inp.CreditLine,
} }
@ -47,7 +47,7 @@ func CardAdd(c *gin.Context) {
card := &db.Card{} card := &db.Card{}
CreateHandler(card, func(src types.DbCard, dst *db.Card) { CreateHandler(card, func(src types.DbCard, dst *db.Card) {
dst.Name = src.Name dst.Name = src.Name
dst.Value = src.Value dst.Balance = src.Balance
dst.HaveCreditLine = src.HaveCreditLine dst.HaveCreditLine = src.HaveCreditLine
dst.CreditLine = src.CreditLine dst.CreditLine = src.CreditLine
})(c) })(c)
@ -72,7 +72,7 @@ func CardPutId(c *gin.Context) {
// Filter used to apply only needed changes from srt to dst before updating dst // Filter used to apply only needed changes from srt to dst before updating dst
func(src types.DbCard, dst *db.Card) { func(src types.DbCard, dst *db.Card) {
dst.Name = src.Name dst.Name = src.Name
dst.Value = src.Value dst.Balance = src.Balance
dst.CreditLine = src.CreditLine dst.CreditLine = src.CreditLine
dst.HaveCreditLine = src.HaveCreditLine dst.HaveCreditLine = src.HaveCreditLine
}, },
@ -80,7 +80,7 @@ func CardPutId(c *gin.Context) {
return types.DbCard{ return types.DbCard{
ID: inp.ID, ID: inp.ID,
Name: inp.Name, Name: inp.Name,
Value: inp.Value, Balance: inp.Balance,
HaveCreditLine: inp.HaveCreditLine, HaveCreditLine: inp.HaveCreditLine,
CreditLine: inp.CreditLine, CreditLine: inp.CreditLine,
} }

View File

@ -25,7 +25,7 @@ type ErrorResponse struct {
type DbCard struct { type DbCard struct {
ID uint `json:"id" example:"1"` ID uint `json:"id" example:"1"`
Name string `json:"name" example:"CreditCard"` Name string `json:"name" example:"CreditCard"`
Value uint64 `json:"value" example:"1000"` Balance uint64 `json:"balance" example:"1000"`
HaveCreditLine bool `json:"have_credit_line" example:"true"` HaveCreditLine bool `json:"have_credit_line" example:"true"`
CreditLine uint64 `json:"credit_line" example:"500000"` CreditLine uint64 `json:"credit_line" example:"500000"`
} }