From 43404adf493e0a663067a1fc0111d027b9b1e7e4 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 30 Oct 2024 22:45:44 +0800 Subject: [PATCH] code refactor --- pkg/converters/iif/iif_transaction_data_file_importer.go | 8 ++++++++ pkg/converters/iif/iif_transaction_data_table.go | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/converters/iif/iif_transaction_data_file_importer.go b/pkg/converters/iif/iif_transaction_data_file_importer.go index a2ee943a..061d99ae 100644 --- a/pkg/converters/iif/iif_transaction_data_file_importer.go +++ b/pkg/converters/iif/iif_transaction_data_file_importer.go @@ -4,8 +4,16 @@ import ( "github.com/mayswind/ezbookkeeping/pkg/converters/datatable" "github.com/mayswind/ezbookkeeping/pkg/core" "github.com/mayswind/ezbookkeeping/pkg/models" + "github.com/mayswind/ezbookkeeping/pkg/utils" ) +var iifTransactionTypeNameMapping = map[models.TransactionType]string{ + models.TRANSACTION_TYPE_MODIFY_BALANCE: utils.IntToString(int(models.TRANSACTION_TYPE_MODIFY_BALANCE)), + models.TRANSACTION_TYPE_INCOME: utils.IntToString(int(models.TRANSACTION_TYPE_INCOME)), + models.TRANSACTION_TYPE_EXPENSE: utils.IntToString(int(models.TRANSACTION_TYPE_EXPENSE)), + models.TRANSACTION_TYPE_TRANSFER: utils.IntToString(int(models.TRANSACTION_TYPE_TRANSFER)), +} + // iifTransactionDataFileImporter defines the structure of intuit interchange format (iif) for transaction data type iifTransactionDataFileImporter struct{} diff --git a/pkg/converters/iif/iif_transaction_data_table.go b/pkg/converters/iif/iif_transaction_data_table.go index 9e376ee2..b7cf1c87 100644 --- a/pkg/converters/iif/iif_transaction_data_table.go +++ b/pkg/converters/iif/iif_transaction_data_table.go @@ -41,13 +41,6 @@ var iifTransactionSupportedColumns = map[datatable.TransactionDataTableColumn]bo datatable.TRANSACTION_DATA_TABLE_DESCRIPTION: true, } -var iifTransactionTypeNameMapping = map[models.TransactionType]string{ - models.TRANSACTION_TYPE_MODIFY_BALANCE: utils.IntToString(int(models.TRANSACTION_TYPE_MODIFY_BALANCE)), - models.TRANSACTION_TYPE_INCOME: utils.IntToString(int(models.TRANSACTION_TYPE_INCOME)), - models.TRANSACTION_TYPE_EXPENSE: utils.IntToString(int(models.TRANSACTION_TYPE_EXPENSE)), - models.TRANSACTION_TYPE_TRANSFER: utils.IntToString(int(models.TRANSACTION_TYPE_TRANSFER)), -} - // iifTransactionDataTable defines the structure of intuit interchange format (iif) transaction data table type iifTransactionDataTable struct { incomeAccountNames map[string]bool