through the PUT /transactions/{transactionId} method.
Restrict the PUT to changing only the category. The other existing
attributes should remain immutable.
Remove the body of the PUT response, it isn't required, and it was
returning a 204, which shouldn't have it.
This patch also extracts the CategoryName as a separate component on the
OpenAPI spec, so that it can be reused on the Transaction.
Issues #26 and #23
46 lines
654 B
Go
46 lines
654 B
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
const InvalidId TransactionId = 0
|
|
|
|
type TransactionId = uint64
|
|
|
|
type Transaction struct {
|
|
Id TransactionId
|
|
Date time.Time
|
|
Description string
|
|
Value decimal.Decimal
|
|
Category *CategoryName
|
|
}
|
|
|
|
type Transactions = []Transaction
|
|
|
|
type Bank struct {
|
|
Id string
|
|
Name string
|
|
NordigenId uuid.UUID
|
|
}
|
|
|
|
type Banks = []Bank
|
|
|
|
type CategoryName = string
|
|
|
|
type Category struct {
|
|
Name CategoryName
|
|
Group *string
|
|
}
|
|
|
|
type Categories = []Category
|
|
|
|
type CategoryGroup struct {
|
|
Name string
|
|
}
|
|
|
|
type CategoryGroups = []CategoryGroup
|