From 19aa73f1471df55b3b7de9adc7168746d5ac2e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Jurmanovi=C4=87?= Date: Fri, 18 Jun 2021 23:23:49 +0200 Subject: [PATCH] fixed types --- pkg/models/subscriptions.go | 2 +- pkg/services/subscriptions.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/models/subscriptions.go b/pkg/models/subscriptions.go index 9103e66..131e96b 100644 --- a/pkg/models/subscriptions.go +++ b/pkg/models/subscriptions.go @@ -25,7 +25,7 @@ type NewSubscriptionBody struct { WalletID string `json:"walletId" form:"walletId"` TransactionTypeID string `json:"transactionTypeId" form:"transactionTypeId"` SubscriptionTypeID string `json:"subscriptionTypeId" pg:"subscription_type_id"` - CustomRange int `json:"customRange", pg:"custom_range"` + CustomRange json.Number `json:"customRange", pg:"custom_range"` StartDate time.Time `json:"startDate" pg:"start_date"` Description string `json:"description" form:"description"` Amount json.Number `json:"amount" form:"amount"` diff --git a/pkg/services/subscriptions.go b/pkg/services/subscriptions.go index b64d31d..606369f 100644 --- a/pkg/services/subscriptions.go +++ b/pkg/services/subscriptions.go @@ -15,12 +15,13 @@ func (as *SubscriptionService) New(body *models.NewSubscriptionBody) *models.Sub tm := new(models.Subscription) amount, _ := body.Amount.Int64() + customRange, _ := body.CustomRange.Int64() tm.Init() tm.WalletID = body.WalletID tm.TransactionTypeID = body.TransactionTypeID tm.SubscriptionTypeID = body.SubscriptionTypeID - tm.CustomRange = body.CustomRange + tm.CustomRange = int(customRange) tm.Description = body.Description tm.StartDate = body.StartDate tm.Amount = int(amount)