48 lines
965 B
Go
48 lines
965 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
type ProductSpec struct {
|
|
Label string
|
|
Value string
|
|
}
|
|
|
|
func (p Product) Specs() []ProductSpec {
|
|
var specs []ProductSpec
|
|
if p.AttrBrand != "" {
|
|
specs = append(specs, ProductSpec{"Бренд", p.AttrBrand})
|
|
}
|
|
if p.AttrSize != "" {
|
|
specs = append(specs, ProductSpec{"Размер", p.AttrSize})
|
|
}
|
|
if p.AttrColor != "" {
|
|
specs = append(specs, ProductSpec{"Цвет", p.AttrColor})
|
|
}
|
|
if p.AttrMaterial != "" {
|
|
specs = append(specs, ProductSpec{"Материал", p.AttrMaterial})
|
|
}
|
|
if p.AttrWeight != "" {
|
|
specs = append(specs, ProductSpec{"Вес", p.AttrWeight})
|
|
}
|
|
return specs
|
|
}
|
|
|
|
type PriceHistoryEntry struct {
|
|
ID int
|
|
ProductID int
|
|
Price float64
|
|
SalePrice float64
|
|
RecordedAt time.Time
|
|
}
|
|
|
|
type Reservation struct {
|
|
ID int
|
|
ProductID int
|
|
SessionKey string
|
|
UserID *int
|
|
CustomerName string
|
|
CustomerPhone string
|
|
ExpiresAt time.Time
|
|
CreatedAt time.Time
|
|
}
|