1
0
Fork 0

refactor: move currency to money package and add new type Price, refactor api and use price there too

This commit is contained in:
Vojtěch Mareš 2024-05-05 18:19:56 +02:00
parent 18d1c98b76
commit ef1526a1ac
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
7 changed files with 127 additions and 137 deletions

View file

@ -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: >