Files
steam_analyzer/internal/domain/item.go
2026-01-17 22:45:02 +03:00

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
}