From e1a46f5fc7895cd6403e49d0cb88f2190a19f782 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 20 Nov 2024 21:00:17 +0200 Subject: [PATCH] Update handler and types.DbCard to accept and send new fields --- handlers/card.go | 6 ++++++ types/types.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/handlers/card.go b/handlers/card.go index ee33400..1415070 100644 --- a/handlers/card.go +++ b/handlers/card.go @@ -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) } diff --git a/types/types.go b/types/types.go index ac0002b..80fec34 100644 --- a/types/types.go +++ b/types/types.go @@ -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 {