diff --git a/db/card.go b/db/card.go index b957c33..b6791dc 100644 --- a/db/card.go +++ b/db/card.go @@ -10,7 +10,7 @@ import ( type Card struct { gorm.Model Name string - Value uint64 + Balance uint64 HaveCreditLine bool CreditLine uint64 UserID uint diff --git a/handlers/card.go b/handlers/card.go index 3e3149f..2efe3fd 100644 --- a/handlers/card.go +++ b/handlers/card.go @@ -24,7 +24,7 @@ func CardGetId(c *gin.Context) { return types.DbCard{ ID: inp.ID, Name: inp.Name, - Value: inp.Value, + Balance: inp.Balance, HaveCreditLine: inp.HaveCreditLine, CreditLine: inp.CreditLine, } @@ -47,7 +47,7 @@ func CardAdd(c *gin.Context) { card := &db.Card{} CreateHandler(card, func(src types.DbCard, dst *db.Card) { dst.Name = src.Name - dst.Value = src.Value + dst.Balance = src.Balance dst.HaveCreditLine = src.HaveCreditLine dst.CreditLine = src.CreditLine })(c) @@ -72,7 +72,7 @@ func CardPutId(c *gin.Context) { // Filter used to apply only needed changes from srt to dst before updating dst func(src types.DbCard, dst *db.Card) { dst.Name = src.Name - dst.Value = src.Value + dst.Balance = src.Balance dst.CreditLine = src.CreditLine dst.HaveCreditLine = src.HaveCreditLine }, @@ -80,7 +80,7 @@ func CardPutId(c *gin.Context) { return types.DbCard{ ID: inp.ID, Name: inp.Name, - Value: inp.Value, + Balance: inp.Balance, HaveCreditLine: inp.HaveCreditLine, CreditLine: inp.CreditLine, } diff --git a/types/types.go b/types/types.go index db16caf..536a954 100644 --- a/types/types.go +++ b/types/types.go @@ -25,7 +25,7 @@ type ErrorResponse struct { type DbCard struct { ID uint `json:"id" example:"1"` 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"` CreditLine uint64 `json:"credit_line" example:"500000"` }