|
@@ -27,44 +27,38 @@ type Product struct {
|
|
|
Collections []string `db:"collections"`
|
|
|
Images []string `db:"images"`
|
|
|
Options []string `db:"options"`
|
|
|
- Variants []string `db:"variants"`
|
|
|
}
|
|
|
|
|
|
func (p *Product) As() *generated.Product {
|
|
|
description := bluemonday.StrictPolicy().Sanitize(p.Description.String)
|
|
|
product := generated.Product{
|
|
|
- AvailableForSale: false,
|
|
|
- Collections: nil,
|
|
|
- CompareAtPriceRange: nil,
|
|
|
- CreatedAt: scalar.NewDateTimeFrom(p.CreatedAt),
|
|
|
- Description: description,
|
|
|
- DescriptionHTML: scalar.Html(p.Description.String),
|
|
|
- FeaturedImage: nil,
|
|
|
- Handle: p.Handle.String,
|
|
|
- ID: model.NewId(model.GidProduct, p.Id),
|
|
|
- Images: nil,
|
|
|
- IsGiftCard: false,
|
|
|
- Media: nil,
|
|
|
- Metafield: nil,
|
|
|
- Metafields: nil,
|
|
|
- OnlineStoreURL: nil,
|
|
|
- Options: nil,
|
|
|
- PriceRange: nil,
|
|
|
- ProductType: p.Type.String,
|
|
|
- PublishedAt: 0,
|
|
|
- RequiresSellingPlan: false,
|
|
|
- SellingPlanGroups: nil,
|
|
|
+ AvailableForSale: false,
|
|
|
+ CompareAtPriceRange: nil,
|
|
|
+ FeaturedImage: nil,
|
|
|
+ Images: nil,
|
|
|
+ IsGiftCard: false,
|
|
|
+ Media: nil,
|
|
|
+ OnlineStoreURL: nil,
|
|
|
+ PriceRange: nil,
|
|
|
+ RequiresSellingPlan: false,
|
|
|
+ SellingPlanGroups: nil,
|
|
|
+ TotalInventory: nil,
|
|
|
+ VariantBySelectedOptions: nil,
|
|
|
+
|
|
|
+ ID: model.NewId(model.GidProduct, p.Id),
|
|
|
+ Handle: p.Handle.String,
|
|
|
+ Title: p.Title,
|
|
|
+ Vendor: p.Vendor.String,
|
|
|
+ Description: description,
|
|
|
+ DescriptionHTML: scalar.Html(p.Description.String),
|
|
|
+ ProductType: p.Type.String,
|
|
|
+ Tags: p.Tags,
|
|
|
Seo: &generated.Seo{
|
|
|
Description: &description,
|
|
|
Title: &p.Title,
|
|
|
},
|
|
|
- Tags: p.Tags,
|
|
|
- Title: p.Title,
|
|
|
- TotalInventory: nil,
|
|
|
- UpdatedAt: scalar.NewDateTimeFrom(p.UpdatedAt),
|
|
|
- VariantBySelectedOptions: nil,
|
|
|
- Variants: nil,
|
|
|
- Vendor: p.Vendor.String,
|
|
|
+ CreatedAt: scalar.NewDateTimeFrom(p.CreatedAt),
|
|
|
+ UpdatedAt: scalar.NewDateTimeFrom(p.UpdatedAt),
|
|
|
}
|
|
|
|
|
|
if p.PublishedAt != nil {
|