From 559fa7efaeb3384d5358f132d2ae2215a5c351ab Mon Sep 17 00:00:00 2001 From: Tim Wundenberg Date: Sun, 25 May 2025 14:12:04 +0200 Subject: [PATCH] wip: recurring transactions --- handler/treasure_chest.go | 4 ++++ main_test.go | 1 - service/transaction_recurring.go | 9 +++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/handler/treasure_chest.go b/handler/treasure_chest.go index c177a06..7af68b3 100644 --- a/handler/treasure_chest.go +++ b/handler/treasure_chest.go @@ -84,6 +84,10 @@ func (h TreasureChestImpl) handleTreasureChestItemComp() http.HandlerFunc { } transactionsRecurring, err := h.transactionRecurring.GetAllByTreasureChest(user, treasureChest.Id.String()) + if err != nil { + handleError(w, r, err) + return + } transactionsRec := tr.TransactionRecurringItems(transactionsRecurring, "", "", treasureChest.Id.String()) var comp templ.Component diff --git a/main_test.go b/main_test.go index 10bdfc9..832cf1d 100644 --- a/main_test.go +++ b/main_test.go @@ -1803,7 +1803,6 @@ func TestIntegrationAccount(t *testing.T) { ":": 400, "*": 400, "|": 400, - "\"": 400, "Account": 200, } diff --git a/service/transaction_recurring.go b/service/transaction_recurring.go index 3c47853..eee9939 100644 --- a/service/transaction_recurring.go +++ b/service/transaction_recurring.go @@ -220,7 +220,7 @@ func (s TransactionRecurringImpl) GetAllByAccount(user *types.User, accountId st return nil, err } - tx.Commit() + err = tx.Commit() err = db.TransformAndLogDbError("transactionRecurring GetAllByAccount", nil, err) if err != nil { return nil, err @@ -273,7 +273,7 @@ func (s TransactionRecurringImpl) GetAllByTreasureChest(user *types.User, treasu return nil, err } - tx.Commit() + err = tx.Commit() err = db.TransformAndLogDbError("transactionRecurring GetAllByTreasureChest", nil, err) if err != nil { return nil, err @@ -441,10 +441,7 @@ func (s TransactionRecurringImpl) validateAndEnrichTransactionRecurring( log.Error("transactionRecurring validate: %v", err) return nil, fmt.Errorf("intervalMonths needs to be greater than 0: %w", ErrBadRequest) } - active := false - if input.Active == "on" { - active = true - } + active := input.Active == "on" transactionRecurring := types.TransactionRecurring{