diff --git a/pkg/api/transactions.go b/pkg/api/transactions.go index 540eb48e..096458be 100644 --- a/pkg/api/transactions.go +++ b/pkg/api/transactions.go @@ -395,8 +395,8 @@ func (a *TransactionsApi) TransactionMonthAmountsHandler(c *core.Context) (inter if !exists { monthTotalAmount = &models.TransactionAmountsResponseItemAmountInfo{ - Currency: account.Currency, - IncomeAmount: 0, + Currency: account.Currency, + IncomeAmount: 0, ExpenseAmount: 0, } } @@ -433,8 +433,8 @@ func (a *TransactionsApi) TransactionMonthAmountsHandler(c *core.Context) (inter } amountsResp = append(amountsResp, &models.TransactionMonthAmountsResponseItem{ - Year: year, - Month: month, + Year: year, + Month: month, Amounts: amounts, }) } diff --git a/pkg/api/users.go b/pkg/api/users.go index 03d20b53..76803709 100644 --- a/pkg/api/users.go +++ b/pkg/api/users.go @@ -132,8 +132,8 @@ func (a *UsersApi) UserUpdateProfileHandler(c *core.Context) (interface{}, *errs anythingUpdate := false userNew := &models.User{ - Uid: user.Uid, - Salt: user.Salt, + Uid: user.Uid, + Salt: user.Salt, } if userUpdateReq.Email != "" && userUpdateReq.Email != user.Email { diff --git a/pkg/exchangerates/euro_central_bank_datasource.go b/pkg/exchangerates/euro_central_bank_datasource.go index 6f5cb3e6..1b18f1ab 100644 --- a/pkg/exchangerates/euro_central_bank_datasource.go +++ b/pkg/exchangerates/euro_central_bank_datasource.go @@ -8,8 +8,8 @@ import ( "github.com/mayswind/lab/pkg/errs" "github.com/mayswind/lab/pkg/log" "github.com/mayswind/lab/pkg/models" - "github.com/mayswind/lab/pkg/validators" "github.com/mayswind/lab/pkg/utils" + "github.com/mayswind/lab/pkg/validators" ) const euroCentralBankExchangeRateUrl = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" diff --git a/pkg/exchangerates/euro_central_bank_datasource_test.go b/pkg/exchangerates/euro_central_bank_datasource_test.go index 9abe84da..eb4143fd 100644 --- a/pkg/exchangerates/euro_central_bank_datasource_test.go +++ b/pkg/exchangerates/euro_central_bank_datasource_test.go @@ -41,11 +41,11 @@ func TestEuroCentralBankDataSource_StandardDataExtractExchangeRates(t *testing.T assert.Equal(t, nil, err) assert.Contains(t, actualLatestExchangeRateResponse.ExchangeRates, &models.LatestExchangeRate{ Currency: "USD", - Rate: "1.1746", + Rate: "1.1746", }) assert.Contains(t, actualLatestExchangeRateResponse.ExchangeRates, &models.LatestExchangeRate{ Currency: "CNY", - Rate: "7.7195", + Rate: "7.7195", }) } @@ -75,8 +75,8 @@ func TestEuroCentralBankDataSource_EmptyEnvelopeContent(t *testing.T) { Context: &gin.Context{}, } - _, err := dataSource.Parse(context, []byte("" + - "" + + _, err := dataSource.Parse(context, []byte(""+ + ""+ "")) assert.NotEqual(t, nil, err) } @@ -87,10 +87,10 @@ func TestEuroCentralBankDataSource_EmptyCubeContent(t *testing.T) { Context: &gin.Context{}, } - _, err := dataSource.Parse(context, []byte("" + - "" + - "" + - "" + + _, err := dataSource.Parse(context, []byte(""+ + ""+ + ""+ + ""+ "")) assert.NotEqual(t, nil, err) } @@ -101,13 +101,13 @@ func TestEuroCentralBankDataSource_InvalidCurrency(t *testing.T) { Context: &gin.Context{}, } - actualLatestExchangeRateResponse, err := dataSource.Parse(context, []byte("" + - "" + - "" + - "" + - "" + - "" + - "" + + actualLatestExchangeRateResponse, err := dataSource.Parse(context, []byte(""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ "")) assert.Equal(t, nil, err) assert.Len(t, actualLatestExchangeRateResponse.ExchangeRates, 0) @@ -119,13 +119,13 @@ func TestEuroCentralBankDataSource_EmptyRate(t *testing.T) { Context: &gin.Context{}, } - actualLatestExchangeRateResponse, err := dataSource.Parse(context, []byte("" + - "" + - "" + - "" + - "" + - "" + - "" + + actualLatestExchangeRateResponse, err := dataSource.Parse(context, []byte(""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ "")) assert.Equal(t, nil, err) assert.Len(t, actualLatestExchangeRateResponse.ExchangeRates, 0) @@ -137,13 +137,13 @@ func TestEuroCentralBankDataSource_InvalidRate(t *testing.T) { Context: &gin.Context{}, } - actualLatestExchangeRateResponse, err := dataSource.Parse(context, []byte("" + - "" + - "" + - "" + - "" + - "" + - "" + + actualLatestExchangeRateResponse, err := dataSource.Parse(context, []byte(""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ "")) assert.Equal(t, nil, err) assert.Len(t, actualLatestExchangeRateResponse.ExchangeRates, 0) diff --git a/pkg/services/transactions.go b/pkg/services/transactions.go index 6020fb33..4aa5ea93 100644 --- a/pkg/services/transactions.go +++ b/pkg/services/transactions.go @@ -1019,8 +1019,8 @@ func (s *TransactionService) GetAccountsMonthTotalIncomeAndExpense(uid int64, st if !exists { monthAccountAmount = &models.TransactionAccountAmount{ - AccountId: transaction.AccountId, - TotalIncomeAmount: 0, + AccountId: transaction.AccountId, + TotalIncomeAmount: 0, TotalExpenseAmount: 0, } monthAccountsAmounts[transaction.AccountId] = monthAccountAmount