feat(transaction): #66 implement transactions

This commit is contained in:
2025-05-14 23:34:52 +02:00
parent c9adb5e928
commit 1ffe3b3961
14 changed files with 342 additions and 302 deletions

View File

@@ -17,21 +17,26 @@ type Transaction struct {
Id uuid.UUID
UserId uuid.UUID `db:"user_id"`
AccountId uuid.UUID `db:"account_id"`
// nil indicates that the transaction is not yet associated with a piggy bank
TreasureChestId *uuid.UUID `db:"treasure_chest_id"`
// The internal transaction is amove between e.g. an account and a piggy bank to execute a savings plan
Internal bool
// The value of the transacion. Negative for outgoing and positive for incoming
Value int64
Timestamp time.Time
Note string
Note string
// account id is only nil, if the transaction is a deposit to a treasure chest
AccountId *uuid.UUID `db:"account_id"`
TreasureChestId *uuid.UUID `db:"treasure_chest_id"`
// The value of the transacion. Negative for outgoing and positive for incoming transactions.
Value int64
CreatedAt time.Time `db:"created_at"`
CreatedBy uuid.UUID `db:"created_by"`
UpdatedAt *time.Time `db:"updated_at"`
UpdatedBy *uuid.UUID `db:"updated_by"`
}
type TransactionInput struct {
Id string
AccountId string
TreasureChestId string
Value string
Timestamp string
Note string
}