Luís Murta 50e8269120
All checks were successful
Go / build (1.22) (pull_request) Successful in 11s
Go / build (1.21) (pull_request) Successful in 11s
Go / build (1.22) (push) Successful in 1m32s
Go / build (1.21) (push) Successful in 1m35s
Support modifying a transaction category
through the PUT /transactions/{transactionId} method.
The category is also returned on a /transaction(s) call.

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
2024-09-13 19:39:24 +01:00

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