Pass only category Id as categories are not to be created on the fly
This commit is contained in:
parent
75b48be20d
commit
2d37ec147c
@ -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 {
|
||||
|
@ -16,7 +16,7 @@ const payload = computed(() => JSON.stringify({
|
||||
Name: Transaction.Payee,
|
||||
ID: Transaction.PayeeID,
|
||||
},
|
||||
category: Transaction.CategoryID,
|
||||
categoryId: Transaction.CategoryID,
|
||||
memo: Transaction.Memo,
|
||||
amount: Transaction.Amount,
|
||||
state: "Uncleared"
|
||||
|
@ -31,10 +31,7 @@ const payload = computed(() => JSON.stringify({
|
||||
Name: TX.value.Payee,
|
||||
ID: TX.value.PayeeID,
|
||||
},
|
||||
category: {
|
||||
Name: TX.value.Category,
|
||||
ID: TX.value.CategoryID,
|
||||
},
|
||||
categoryId: TX.value.CategoryID,
|
||||
memo: TX.value.Memo,
|
||||
amount: TX.value.Amount,
|
||||
state: "Uncleared"
|
||||
|
Loading…
x
Reference in New Issue
Block a user