changes with app variant
This commit is contained in:
@@ -26,7 +26,7 @@ type ProductService interface {
|
||||
GetLocationProductSummary(tenantID, locationID int) ([]models.ProductSummary, error)
|
||||
GetSaleTemplate(tenantID, locationID int) (*models.SaleTemplate, error)
|
||||
FetchFilteredProducts(categoryID, subcategoryID, productID, applocationID, tenantID, locationID int, keyword, productStatus, approve string, pageno, pagesize int) ([]models.Tenantproducts, error)
|
||||
GetProductByVariant(tenantid, variantid, locationid int) ([]models.Products, error)
|
||||
GetProductByVariant(tenantid, variantid, locationid, productid int) ([]models.Products, error)
|
||||
GetProductsBySubcategory(params models.ProductFilter) (map[string]interface{}, error)
|
||||
UpdateProductLocation(input models.Productlocations) error
|
||||
CreateProductLocation(input []models.Productlocations) error
|
||||
@@ -169,19 +169,21 @@ func (s *productService) FetchFilteredProducts(categoryID, subcategoryID, produc
|
||||
return s.repo.FetchFilteredProducts(categoryID, subcategoryID, productID, applocationID, tenantID, locationID, keyword, productStatus, approve, pageno, pagesize)
|
||||
}
|
||||
|
||||
func (s *productService) GetProductByVariant(tenantid, variantid, locationid int) ([]models.Products, error) {
|
||||
func (s *productService) GetProductByVariant(tenantid, variantid, locationid, productid int) ([]models.Products, error) {
|
||||
|
||||
var data []models.Products
|
||||
|
||||
result, err := s.repo.GetProductByVariant(tenantid, variantid, locationid)
|
||||
result, err := s.repo.GetProductByVariant(tenantid, variantid, locationid, productid)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data = result
|
||||
|
||||
return data, nil
|
||||
// Same rule as the browse list: you can only order what the shop has.
|
||||
//
|
||||
// Applied here too so the two screens cannot disagree. Without it a variant
|
||||
// group would offer every size on the order sheet while the list that led
|
||||
// there showed only the stocked ones, and a shopper could pick a size the
|
||||
// branch has none of. Unscoped calls are left alone — see InStockOnly.
|
||||
return InStockOnly(result, locationid), nil
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user