Pass only category Id as categories are not to be created on the fly
This commit is contained in:
@ -19,15 +19,12 @@ type NewTransactionPayload struct {
|
||||
Name string
|
||||
IsAccount bool
|
||||
} `json:"payee"`
|
||||
Category struct {
|
||||
ID uuid.NullUUID
|
||||
Name string
|
||||
} `json:"category"`
|
||||
Memo string `json:"memo"`
|
||||
Amount string `json:"amount"`
|
||||
BudgetID uuid.UUID `json:"budgetId"`
|
||||
AccountID uuid.UUID `json:"accountId"`
|
||||
State string `json:"state"`
|
||||
CategoryID uuid.NullUUID `json:"categoryId"`
|
||||
Memo string `json:"memo"`
|
||||
Amount string `json:"amount"`
|
||||
BudgetID uuid.UUID `json:"budgetId"`
|
||||
AccountID uuid.UUID `json:"accountId"`
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
func (h *Handler) newTransaction(c *gin.Context) {
|
||||
@ -72,7 +69,7 @@ func (h *Handler) newTransaction(c *gin.Context) {
|
||||
newTransaction.PayeeID = payeeID
|
||||
}
|
||||
|
||||
newTransaction.CategoryID = payload.Category.ID
|
||||
newTransaction.CategoryID = payload.CategoryID
|
||||
newTransaction.AccountID = payload.AccountID
|
||||
transaction, err := h.Service.CreateTransaction(c.Request.Context(), newTransaction)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user