bugs on variant id
This commit is contained in:
@@ -11,6 +11,7 @@ type CatalogueService interface {
|
||||
GetProducts(brand, category, keyword string, pageno, pagesize int) ([]models.CatalogueProduct, int64, error)
|
||||
GetProductBySKU(brand, sku string) (*models.CatalogueProduct, error)
|
||||
GetProductByID(brand string, id int64) (*models.CatalogueProduct, error)
|
||||
GetProductByImageID(brand, imageID string) (*models.CatalogueProduct, error)
|
||||
}
|
||||
|
||||
type catalogueService struct {
|
||||
@@ -37,6 +38,13 @@ func (s *catalogueService) GetProductBySKU(brand, sku string) (*models.Catalogue
|
||||
return s.repo.GetProductBySKU(brand, sku)
|
||||
}
|
||||
|
||||
// GetProductByImageID is the join the ingest manifest needs: the pipeline
|
||||
// reports what it wrote as image_id values, and importing into a shop needs
|
||||
// the row id.
|
||||
func (s *catalogueService) GetProductByImageID(brand, imageID string) (*models.CatalogueProduct, error) {
|
||||
return s.repo.GetProductByImageID(brand, imageID)
|
||||
}
|
||||
|
||||
func (s *catalogueService) GetProductByID(brand string, id int64) (*models.CatalogueProduct, error) {
|
||||
return s.repo.GetProductByID(brand, id)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ type ProductService interface {
|
||||
GetCatalougeProducts(tenantID, locationID, subcategoryID, pageno, pagesize int, keyword string) ([]models.Products, error)
|
||||
GetProductStocks(tenantID, locationID string) ([]models.Productstocks, error)
|
||||
UpdateProductStatus(productIDs []int, status string) error
|
||||
UpdateProductVariant(productid, variantid int) error
|
||||
CreateProductStock(stocks []models.Productstock) error
|
||||
CreateProduct(product models.Products) error
|
||||
UpdateProduct(product models.Products) error
|
||||
@@ -132,6 +133,16 @@ func (s *productService) CreateProductStock(stocks []models.Productstock) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateProductVariant groups an existing product, or ungroups it with 0.
|
||||
//
|
||||
// The ordering screen reads products.variants to decide whether a product is
|
||||
// one choice or several, and nothing could write that column after creation —
|
||||
// so a catalogue import, which is how products actually arrive, produced
|
||||
// permanently ungrouped products.
|
||||
func (s *productService) UpdateProductVariant(productid, variantid int) error {
|
||||
return s.repo.UpdateProductVariant(productid, variantid)
|
||||
}
|
||||
|
||||
func (s *productService) UpdateProductStatus(productIDs []int, status string) error {
|
||||
return s.repo.UpdateProductStatus(productIDs, status)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user