Add Transaction to list after saving
This commit is contained in:
@ -68,8 +68,11 @@ func (h *Handler) newTransaction(c *gin.Context) {
|
||||
CategoryID: payload.Category.ID,
|
||||
Status: postgres.TransactionStatus(payload.State),
|
||||
}
|
||||
_, err = h.Service.CreateTransaction(c.Request.Context(), newTransaction)
|
||||
transaction, err := h.Service.CreateTransaction(c.Request.Context(), newTransaction)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("create transaction: %w", err))
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, transaction)
|
||||
}
|
||||
|
Reference in New Issue
Block a user