1
0
Fork 0
This commit is contained in:
Vojtěch Mareš 2024-05-04 18:21:37 +02:00
parent 7ed1e05284
commit 49e05cac10
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
23 changed files with 613 additions and 253 deletions

View file

@ -4,6 +4,11 @@ import "github.com/google/uuid"
type AttendeeID uuid.UUID
func NewAttendeeID() AttendeeID {
id := uuid.Must(uuid.NewV7())
return AttendeeID(id)
}
type Attendee struct {
ID AttendeeID
DateID DateID

View file

@ -8,15 +8,21 @@ import (
type DateID uuid.UUID
type Date struct {
ID DateID
TrainingID ID
Date time.Time
StartTime time.Time
Days int8
Price Price
IsOnline bool
Location string // could be empty (null) for example: Prague, Brno, London, ...
Address string // could be empty (null)
Capacity int8
func NewDateID() DateID {
id := uuid.Must(uuid.NewV7())
return DateID(id)
}
type Date struct {
ID DateID
TrainingID ID
Date time.Time
StartTime time.Time
Days int8
IsOnline bool
Location string // could be empty (null) for example: Prague, Brno, London, ...
Address string // could be empty (null)
Capacity int8
PriceAmount float64
PriceCurrency string
}

View file

@ -1,3 +1,22 @@
package training
type Price float32
// type Price float32
type TrainingPrice struct {
Currency string `json:"currency"`
Amount float64 `json:"amount"`
Type PriceType `json:"type"` // open | corporate
}
type PriceType string
var (
PriceTypes = []PriceType{OpenPrice, CorporatePrice, StudentPrice, GovernmentPrice}
)
const (
OpenPrice PriceType = "OPEN"
CorporatePrice PriceType = "CORPORATE"
StudentPrice PriceType = "STUDENT"
GovernmentPrice PriceType = "GOVERNMENT"
)

View file

@ -6,10 +6,15 @@ import (
type ID uuid.UUID
func NewID() ID {
id := uuid.Must(uuid.NewV7())
return ID(id)
}
type Training struct {
ID ID
Days int8
Name string
Description string
Price Price
Price []TrainingPrice
}