Remove commented code and TODOs

This commit is contained in:
Jan Bader 2022-02-20 22:46:51 +00:00
parent cfda327a5d
commit 4688d2d94d

View File

@ -41,50 +41,20 @@ func (h *Handler) newTransaction(c *gin.Context) {
err = amount.Set(payload.Amount) err = amount.Set(payload.Amount)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, fmt.Errorf("amount: %w", err)) 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{ newTransaction := postgres.CreateTransactionParams{
Memo: payload.Memo, Memo: payload.Memo,
Date: time.Time(payload.Date), Date: time.Time(payload.Date),
Amount: amount, Amount: amount,
AccountID: payload.AccountID, AccountID: payload.AccountID,
PayeeID: payload.Payee.ID, // TODO handle new payee PayeeID: payload.Payee.ID,
CategoryID: payload.Category.ID, // TODO handle new category CategoryID: payload.Category.ID,
Status: postgres.TransactionStatus(payload.State), Status: postgres.TransactionStatus(payload.State),
} }
_, err = h.Service.CreateTransaction(c.Request.Context(), newTransaction) _, err = h.Service.CreateTransaction(c.Request.Context(), newTransaction)
if err != nil { if err != nil {
c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("create transaction: %w", err)) 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))
}*/
} }