-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
55 lines (47 loc) · 2.04 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package importer
import (
"github.com/envelope-zero/backend/v2/pkg/models"
"github.com/google/uuid"
)
// 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 ParsedResources struct {
Budget models.Budget
Accounts []models.Account
Categories map[string]Category
Allocations []Allocation
Transactions []Transaction
MonthConfigs []MonthConfig
}
type Category struct {
Model models.Category
Envelopes map[string]Envelope
}
type Envelope struct {
Model models.Envelope
}
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 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 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
}
// TransactionPreview is used to preview transactions that will be imported to allow for editing.
type TransactionPreview struct {
Transaction models.TransactionCreate `json:"transaction"`
SourceAccountName string `json:"sourceAccountName" example:"Employer"` // Name of the source account if the ID is not known
DestinationAccountName string `json:"destinationAccountName" example:"Deutsche Bahn"` // Name of the destination account if the ID is not known
DuplicateTransactionIDs []uuid.UUID `json:"duplicateTransactionIds"` // IDs of transactions that this transaction duplicates
}