diff --git a/.env.example b/.env.example index 53dd7e6..156194e 100644 --- a/.env.example +++ b/.env.example @@ -1,17 +1,12 @@ -couch_db_source=http://admin:adminadmin@192.168.1.2:5984/ +couch_db_source= db_trendyol=trendyol_db_v2 db_ty_categories=ty_categories -remote_url=https://sarga.com.tm/api/ +remote_url= descendant_category_url=descendant-categories -db=test_baza -du=merdan -dp=qazwsx12 -da=localhost -dp=3306 -#database_url ="merdan:qazwsx12@tcp(127.0.0.1:3306)/test_baza?parseTime=true" -database_url ="orient:orient@tcp(192.168.1.2:3306)/bagisto_sarga?parseTime=true" -couchdb_url = "http://admin:adminadmin@192.168.1.2:5984/" -scout_flash = "http://sarga.com.tm/scrap/scoute-flush" \ No newline at end of file +database_url= +couchdb_url= +scout_flash= +port= \ No newline at end of file diff --git a/gorm_models/product.go b/gorm_models/product.go index 69cb85a..8fb2e1e 100644 --- a/gorm_models/product.go +++ b/gorm_models/product.go @@ -65,6 +65,8 @@ type ProductFlat struct { MetaKeywords string `sql:"DEFAULT:NULL" gorm:"default:null"` BrandID uint `sql:"DEFAULT:NULL" gorm:"default:null"` Brand Brand + Cinsiyet int `sql:"DEFAULT:NULL" gorm:"default:null"` + CinsiyetLabel string `sql:"DEFAULT:NULL" gorm:"default:null"` } type ProductImage struct { diff --git a/repositories/ProductRepository.go b/repositories/ProductRepository.go index 1af0f09..2350348 100644 --- a/repositories/ProductRepository.go +++ b/repositories/ProductRepository.go @@ -162,6 +162,11 @@ func (pr *ProductRepo) makeProductFlat(productId uint) gm.ProductFlat { flat.BrandID = pr.Brand.ID } + if pr.Data.Cinsiyet != "" { + flat.Cinsiyet = int(pr.SexOption.ID) + flat.CinsiyetLabel = pr.Data.Cinsiyet + } + if !pr.HasSizeVariants() { flat.MinPrice = pr.Data.Price.DiscountedPrice.Value flat.MaxPrice = math.Max(pr.Data.Price.OriginalPrice.Value, pr.Data.Price.DiscountedPrice.Value) @@ -229,6 +234,15 @@ func (pr *ProductRepo) makeVariantFlat(variant models.Variant, SizID, parentID, flat.ColorLabel = pr.Data.Color } + if pr.Data.Brand != "" { + flat.BrandID = pr.Brand.ID + } + + if pr.Data.Cinsiyet != "" { + flat.Cinsiyet = int(pr.SexOption.ID) + flat.CinsiyetLabel = pr.Data.Cinsiyet + } + return flat }