importer

package
v3.22.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

README

importer

There are two types of importers:

  • Budget importers. These import whole budgets at once.
  • Transaction importers. These import transactions for a specified account. This is a two-step process: Transaction importers return a slice of TransactionPreview objects. These are returned by the API to allow users to edit the transactions before finally importing them.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(db *gorm.DB, resources ParsedResources) (models.Budget, error)

Types

type Allocation

type Allocation struct {
	Model    models.Allocation
	Category string // There is a category here since an envelope with the same name can exist for multiple categories
	Envelope string
}

type Category

type Category struct {
	Model     models.Category
	Envelopes map[string]Envelope
}

type Envelope

type Envelope struct {
	Model models.Envelope
}

type MatchRule added in v3.4.0

type MatchRule struct {
	models.MatchRule
	Account string
}

MatchRule represents a MatchRule to be imported.

type MonthConfig

type MonthConfig struct {
	Model    models.MonthConfig
	Category string // There is a category here since an envelope with the same name can exist for multiple categories
	Envelope string
}

type ParsedResources

type ParsedResources struct {
	Budget       models.Budget
	Accounts     []models.Account
	Categories   map[string]Category
	Allocations  []Allocation
	Transactions []Transaction
	MonthConfigs []MonthConfig
	MatchRules   []MatchRule
}

ParsedResources is the struct containing all resources that are to be created Named resources are in maps with their names as keys to enable easy deduplication and iteration through them.

type Transaction

type Transaction struct {
	Model                  models.Transaction
	SourceAccountHash      string // Import hash of the source account
	DestinationAccountHash string // Import hash of the destination account
	Category               string // There is a category here since an envelope with the same name can exist for multiple categories
	Envelope               string
}

type TransactionPreview

type TransactionPreview struct {
	Transaction             models.TransactionCreate `json:"transaction"`
	SourceAccountName       string                   `json:"sourceAccountName" example:"Employer"`                        // Name of the source account from the CSV file
	DestinationAccountName  string                   `json:"destinationAccountName" example:"Deutsche Bahn"`              // Name of the destination account from the CSV file
	DuplicateTransactionIDs []uuid.UUID              `json:"duplicateTransactionIds"`                                     // IDs of transactions that this transaction duplicates
	RenameRuleID            uuid.UUID                `json:"renameRuleId" example:"042d101d-f1de-4403-9295-59dc0ea58677"` // ID of the match rule that was applied to this transaction preview. This is kept for backwards compatibility and will be removed with API version 3

	MatchRuleID uuid.UUID `json:"matchRuleId" example:"042d101d-f1de-4403-9295-59dc0ea58677"` // ID of the match rule that was applied to this transaction preview
}

TransactionPreview is used to preview transactions that will be imported to allow for editing.

func (TransactionPreview) TransformV3 added in v3.14.1

func (t TransactionPreview) TransformV3() TransactionPreviewV3

transformV3 transforms a TransactionPreview to a TransactionPreviewV3.

type TransactionPreviewV3 added in v3.14.1

type TransactionPreviewV3 struct {
	Transaction             models.TransactionCreate `json:"transaction"`
	SourceAccountName       string                   `json:"sourceAccountName" example:"Employer"`                       // Name of the source account from the CSV file
	DestinationAccountName  string                   `json:"destinationAccountName" example:"Deutsche Bahn"`             // Name of the destination account from the CSV file
	DuplicateTransactionIDs []uuid.UUID              `json:"duplicateTransactionIds"`                                    // IDs of transactions that this transaction duplicates
	MatchRuleID             *uuid.UUID               `json:"matchRuleId" example:"042d101d-f1de-4403-9295-59dc0ea58677"` // ID of the match rule that was applied to this transaction preview
}

TransactionPreviewV3 is used to preview transactions that will be imported to allow for editing.

Directories

Path Synopsis
parser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL