refactor: move currency to money package and add new type Price, refactor api and use price there too
This commit is contained in:
parent
18d1c98b76
commit
ef1526a1ac
7 changed files with 127 additions and 137 deletions
|
|
@ -350,32 +350,17 @@ components:
|
|||
path: gitlab.mareshq.com/hq/yggdrasil/pkg/training
|
||||
|
||||
TrainingPrice:
|
||||
type: object
|
||||
properties:
|
||||
currency:
|
||||
type: string
|
||||
enum:
|
||||
- CZK
|
||||
- EUR
|
||||
- USD
|
||||
x-go-type: currency.Currency
|
||||
x-go-type-package:
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/internal/currency
|
||||
amount:
|
||||
type: number
|
||||
minimum: 0
|
||||
x-go-type: decimal.Decimal
|
||||
x-go-type-package:
|
||||
path: github.com/shopspring/decimal
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- OPEN
|
||||
- CORPORATE
|
||||
required:
|
||||
- currency
|
||||
- amount
|
||||
- type
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/Price"
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- OPEN
|
||||
- CORPORATE
|
||||
required:
|
||||
- type
|
||||
|
||||
CreateTrainingDateRequest:
|
||||
$ref: "#/components/schemas/NewTrainingDate"
|
||||
|
|
@ -443,7 +428,7 @@ components:
|
|||
format: int8
|
||||
minimum: 1
|
||||
price:
|
||||
$ref: "#/components/schemas/TrainingDatePrice"
|
||||
$ref: "#/components/schemas/Price"
|
||||
required:
|
||||
- trainingID
|
||||
- date
|
||||
|
|
@ -465,7 +450,14 @@ components:
|
|||
required:
|
||||
- id
|
||||
|
||||
TrainingDatePrice:
|
||||
TrainingDateID:
|
||||
type: string
|
||||
format: uuid
|
||||
x-go-type: training.TrainingDateID
|
||||
x-go-type-import:
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/pkg/training
|
||||
|
||||
Price:
|
||||
type: object
|
||||
properties:
|
||||
currency:
|
||||
|
|
@ -474,9 +466,9 @@ components:
|
|||
- CZK
|
||||
- EUR
|
||||
- USD
|
||||
x-go-type: currency.Currency
|
||||
x-go-type: money.Currency
|
||||
x-go-type-package:
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/internal/currency
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/internal/money
|
||||
amount:
|
||||
type: number
|
||||
minimum: 0
|
||||
|
|
@ -487,13 +479,6 @@ components:
|
|||
- currency
|
||||
- amount
|
||||
|
||||
TrainingDateID:
|
||||
type: string
|
||||
format: uuid
|
||||
x-go-type: training.TrainingDateID
|
||||
x-go-type-import:
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/pkg/training
|
||||
|
||||
ProblemDetails:
|
||||
type: object
|
||||
description: >
|
||||
|
|
|
|||
Reference in a new issue