60 lines
3.6 KiB
Go
60 lines
3.6 KiB
Go
package model
|
|
|
|
import "encoding/json"
|
|
|
|
// ProductDescription contains all the information visible on webpage, in given language.
|
|
type ProductDescription struct {
|
|
ProductID uint `gorm:"column:id_product;primaryKey" json:"product_id" form:"product_id"`
|
|
ShopID uint `gorm:"column:id_shop;primaryKey" json:"shop_id" form:"shop_id"`
|
|
LangID uint `gorm:"column:id_lang;primaryKey" json:"lang_id" form:"lang_id"`
|
|
Description string `gorm:"column:description;type:text" json:"description" form:"description"`
|
|
DescriptionShort string `gorm:"column:description_short;type:text" json:"description_short" form:"description_short"`
|
|
LinkRewrite string `gorm:"column:link_rewrite;type:varchar(128)" json:"link_rewrite" form:"link_rewrite"`
|
|
MetaDescription string `gorm:"column:meta_description;type:varchar(512)" json:"meta_description" form:"meta_description"`
|
|
MetaKeywords string `gorm:"column:meta_keywords;type:varchar(255)" json:"meta_keywords" form:"meta_keywords"`
|
|
MetaTitle string `gorm:"column:meta_title;type:varchar(128)" json:"meta_title" form:"meta_title"`
|
|
Name string `gorm:"column:name;type:varchar(128)" json:"name" form:"name"`
|
|
AvailableNow string `gorm:"column:available_now;type:varchar(255)" json:"available_now" form:"available_now"`
|
|
AvailableLater string `gorm:"column:available_later;type:varchar(255)" json:"available_later" form:"available_later"`
|
|
DeliveryInStock string `gorm:"column:delivery_in_stock;type:varchar(255)" json:"delivery_in_stock" form:"delivery_in_stock"`
|
|
DeliveryOutStock string `gorm:"column:delivery_out_stock;type:varchar(255)" json:"delivery_out_stock" form:"delivery_out_stock"`
|
|
Usage string `gorm:"column:usage;type:text" json:"usage" form:"usage"`
|
|
}
|
|
|
|
type ProductRow struct {
|
|
IDProduct int `gorm:"column:id_product"`
|
|
IDShop int `gorm:"column:id_shop"`
|
|
Name string `gorm:"column:name"`
|
|
Active uint8 `gorm:"column:active"`
|
|
Reference string `gorm:"column:reference"`
|
|
}
|
|
|
|
type MeiliSearchProduct struct {
|
|
ProductID uint `gorm:"column:id_product" json:"product_id"`
|
|
Name string `gorm:"column:name" json:"name"`
|
|
// Active uint8 `gorm:"column:active" json:"active"`
|
|
// Description string `gorm:"column:description" json:"description"`
|
|
Description string `gorm:"column:description" json:"description"`
|
|
// Usage string `gorm:"column:used_for" json:"usage"`
|
|
EAN13 string `gorm:"column:ean13" json:"ean13"`
|
|
Reference string `gorm:"column:reference" json:"reference"`
|
|
Price float64 `gorm:"column:price" json:"price"`
|
|
CategoryID uint `gorm:"column:id_category" json:"category_id"`
|
|
CatName string `gorm:"column:cat_name" json:"cat_name"`
|
|
LRew string `gorm:"column:l_rew" json:"l_rew"`
|
|
|
|
// JSON fields stored as raw, converted to string for search
|
|
Attr json.RawMessage `gorm:"column:attr" json:"attr"`
|
|
// AttributeFilters json.RawMessage `gorm:"column:attribute_filters" json:"attribute_filters"`
|
|
Feat json.RawMessage `gorm:"column:feat" json:"feat"`
|
|
|
|
// String versions for searchable text (populated during indexing)
|
|
FeaturesStr string `gorm:"-" json:"features_str"`
|
|
AttributesStr string `gorm:"-" json:"attributes_str"`
|
|
AttributeFiltersStr string `gorm:"-" json:"attribute_filters_str"`
|
|
|
|
IDImage uint `gorm:"column:id_image" json:"id_image"` // Cover image ID (not indexed)
|
|
CategoryIDs json.RawMessage `gorm:"column:category_ids" json:"category_ids"` // All category IDs including children for filtering
|
|
Variations uint `gorm:"column:variations" json:"variations"`
|
|
}
|