From 4688d2d94dbc77203a00c83abf96e2a7a5c29b45 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Sun, 20 Feb 2022 22:46:51 +0000 Subject: [PATCH] Remove commented code and TODOs --- server/transaction.go | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/server/transaction.go b/server/transaction.go index 36e6380..072f8ad 100644 --- a/server/transaction.go +++ b/server/transaction.go @@ -41,50 +41,20 @@ func (h *Handler) newTransaction(c *gin.Context) { err = amount.Set(payload.Amount) if err != nil { c.AbortWithError(http.StatusBadRequest, fmt.Errorf("amount: %w", err)) + return } - /*transactionUUID, err := getNullUUIDFromParam(c, "transactionid") - if err != nil { - c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("parse transaction id: %w", err)) - return - }*/ - - // if !transactionUUID.Valid { newTransaction := postgres.CreateTransactionParams{ Memo: payload.Memo, Date: time.Time(payload.Date), Amount: amount, AccountID: payload.AccountID, - PayeeID: payload.Payee.ID, // TODO handle new payee - CategoryID: payload.Category.ID, // TODO handle new category + PayeeID: payload.Payee.ID, + CategoryID: payload.Category.ID, Status: postgres.TransactionStatus(payload.State), } _, err = h.Service.CreateTransaction(c.Request.Context(), newTransaction) if err != nil { c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("create transaction: %w", err)) } - // } - /* - _, delete := c.GetPostForm("delete") - if delete { - err = h.Service.DeleteTransaction(c.Request.Context(), transactionUUID.UUID) - if err != nil { - c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("delete transaction: %w", err)) - } - return - } - - update := postgres.UpdateTransactionParams{ - ID: transactionUUID.UUID, - Memo: payload.Memo, - Date: time.Time(payload.Date), - Amount: amount, - AccountID: transactionAccountID, - PayeeID: payload.Payee.ID, //TODO handle new payee - CategoryID: payload.Category.ID, //TODO handle new category - } - err = h.Service.UpdateTransaction(c.Request.Context(), update) - if err != nil { - c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("update transaction: %w", err)) - }*/ }