56 lines
770 B
Go
56 lines
770 B
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type SteamItem struct {
|
|
ID uuid.UUID
|
|
Name string
|
|
ClassID string
|
|
GameID int
|
|
Price float64
|
|
Count int
|
|
History []ItemPriceHistory
|
|
}
|
|
|
|
func (si SteamItem) ToDB() DBItem {
|
|
return DBItem{
|
|
ID: si.ID,
|
|
Name: si.Name,
|
|
ClassID: si.ClassID,
|
|
GameID: si.GameID,
|
|
}
|
|
}
|
|
|
|
func (si SteamItem) ToDBHistory() DBItemHistory {
|
|
return DBItemHistory{
|
|
ItemID: si.ID,
|
|
Price: si.Price,
|
|
Count: si.Count,
|
|
Date: time.Now(),
|
|
}
|
|
}
|
|
|
|
type ItemPriceHistory struct {
|
|
Price float64
|
|
Count int
|
|
Date time.Time
|
|
}
|
|
|
|
type DBItem struct {
|
|
ID uuid.UUID
|
|
Name string
|
|
ClassID string
|
|
GameID int
|
|
}
|
|
|
|
type DBItemHistory struct {
|
|
ItemID uuid.UUID
|
|
Price float64
|
|
Count int
|
|
Date time.Time
|
|
}
|