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
|
Name string
|
||||||
IsAccount bool
|
IsAccount bool
|
||||||
} `json:"payee"`
|
} `json:"payee"`
|
||||||
Category struct {
|
CategoryID uuid.NullUUID `json:"categoryId"`
|
||||||
ID uuid.NullUUID
|
Memo string `json:"memo"`
|
||||||
Name string
|
Amount string `json:"amount"`
|
||||||
} `json:"category"`
|
BudgetID uuid.UUID `json:"budgetId"`
|
||||||
Memo string `json:"memo"`
|
AccountID uuid.UUID `json:"accountId"`
|
||||||
Amount string `json:"amount"`
|
State string `json:"state"`
|
||||||
BudgetID uuid.UUID `json:"budgetId"`
|
|
||||||
AccountID uuid.UUID `json:"accountId"`
|
|
||||||
State string `json:"state"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) newTransaction(c *gin.Context) {
|
func (h *Handler) newTransaction(c *gin.Context) {
|
||||||
@ -72,7 +69,7 @@ func (h *Handler) newTransaction(c *gin.Context) {
|
|||||||
newTransaction.PayeeID = payeeID
|
newTransaction.PayeeID = payeeID
|
||||||
}
|
}
|
||||||
|
|
||||||
newTransaction.CategoryID = payload.Category.ID
|
newTransaction.CategoryID = payload.CategoryID
|
||||||
newTransaction.AccountID = payload.AccountID
|
newTransaction.AccountID = payload.AccountID
|
||||||
transaction, err := h.Service.CreateTransaction(c.Request.Context(), newTransaction)
|
transaction, err := h.Service.CreateTransaction(c.Request.Context(), newTransaction)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,7 +16,7 @@ const payload = computed(() => JSON.stringify({
|
|||||||
Name: Transaction.Payee,
|
Name: Transaction.Payee,
|
||||||
ID: Transaction.PayeeID,
|
ID: Transaction.PayeeID,
|
||||||
},
|
},
|
||||||
category: Transaction.CategoryID,
|
categoryId: Transaction.CategoryID,
|
||||||
memo: Transaction.Memo,
|
memo: Transaction.Memo,
|
||||||
amount: Transaction.Amount,
|
amount: Transaction.Amount,
|
||||||
state: "Uncleared"
|
state: "Uncleared"
|
||||||
|
@ -31,10 +31,7 @@ const payload = computed(() => JSON.stringify({
|
|||||||
Name: TX.value.Payee,
|
Name: TX.value.Payee,
|
||||||
ID: TX.value.PayeeID,
|
ID: TX.value.PayeeID,
|
||||||
},
|
},
|
||||||
category: {
|
categoryId: TX.value.CategoryID,
|
||||||
Name: TX.value.Category,
|
|
||||||
ID: TX.value.CategoryID,
|
|
||||||
},
|
|
||||||
memo: TX.value.Memo,
|
memo: TX.value.Memo,
|
||||||
amount: TX.value.Amount,
|
amount: TX.value.Amount,
|
||||||
state: "Uncleared"
|
state: "Uncleared"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user