Add duplicate transaction check from log and transaction description LIKE match

This commit is contained in:
2024-08-28 22:41:05 +03:00
parent e1c9f56921
commit fb7796c475
5 changed files with 88 additions and 15 deletions

View File

@ -1,25 +1,26 @@
package config
type Config struct {
Accounts []ConfigAccount `json:"accounts"`
TransactionTypes []ConfigTransactionTypes `json:"transaction_types"`
Accounts []Account `json:"accounts"`
TransactionTypes []TransactionTypes `json:"transaction_types"`
}
type ConfigAccount struct {
type Account struct {
Firefly3Name string `json:"firefly3_name,omitempty"`
MonobankId string `json:"monobank_id,omitempty"`
Currency string `json:"currency,omitempty"`
}
type ConfigTransactionTypes struct {
Names []string `json:"names,omitempty"`
NamesRefund []string `json:"names_refund,omitempty"`
MccCodes []int `json:"mcc_codes,omitempty"`
Firefly3 ConfigTransactionTypeFirefly3 `json:"firefly3,omitempty"`
SumMax int `json:"sum_max,omitempty"`
type TransactionTypes struct {
Names []string `json:"names,omitempty"`
NamesRefund []string `json:"names_refund,omitempty"`
NamesLooseMatch bool `json:"names_loose_match,omitempty"` // "name%" match
MccCodes []int `json:"mcc_codes,omitempty"`
Firefly3 TransactionTypeFirefly3 `json:"firefly3,omitempty"`
SumMax int `json:"sum_max,omitempty"`
}
type ConfigTransactionTypeFirefly3 struct {
type TransactionTypeFirefly3 struct {
Type string `json:"type,omitempty"`
Destination string `json:"destination,omitempty"`
Description string `json:"description,omitempty"`

View File

@ -1,21 +1,21 @@
package config
func (c *Config) GetAccountByMonobankId(q string) ConfigAccount {
func (c *Config) GetAccountByMonobankId(q string) Account {
for _, row := range c.Accounts {
if row.MonobankId == q {
return row
}
}
return ConfigAccount{}
return Account{}
}
func (c *Config) GetAccountByFirefly3Name(q string) ConfigAccount {
func (c *Config) GetAccountByFirefly3Name(q string) Account {
for _, row := range c.Accounts {
if row.Firefly3Name == q {
return row
}
}
return ConfigAccount{}
return Account{}
}