package catalog import ( "time" "github.com/google/uuid" "github.com/shopspring/decimal" ) // Product - Номенклатура type Product struct { ID uuid.UUID `gorm:"type:uuid;primary_key;"` ParentID *uuid.UUID `gorm:"type:uuid;index"` Name string `gorm:"type:varchar(255);not null"` Type string `gorm:"type:varchar(50);index"` // GOODS, DISH, PREPARED, etc. Num string `gorm:"type:varchar(50)"` Code string `gorm:"type:varchar(50)"` UnitWeight decimal.Decimal `gorm:"type:numeric(19,4)"` UnitCapacity decimal.Decimal `gorm:"type:numeric(19,4)"` IsDeleted bool `gorm:"default:false"` Parent *Product `gorm:"foreignKey:ParentID"` Children []*Product `gorm:"foreignKey:ParentID"` CreatedAt time.Time UpdatedAt time.Time } // Repository интерфейс для каталога type Repository interface { SaveProducts(products []Product) error GetAll() ([]Product, error) GetActiveGoods() ([]Product, error) }