35 lines
1006 B
Go
35 lines
1006 B
Go
package productService
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"git.ma-al.com/goc_daniel/b2b/app/model"
|
|
"git.ma-al.com/goc_daniel/b2b/app/repos/productsRepo"
|
|
constdata "git.ma-al.com/goc_daniel/b2b/app/utils/const_data"
|
|
"git.ma-al.com/goc_daniel/b2b/app/utils/query/filters"
|
|
"git.ma-al.com/goc_daniel/b2b/app/utils/query/find"
|
|
)
|
|
|
|
type ProductService struct {
|
|
productsRepo productsRepo.UIProductsRepo
|
|
}
|
|
|
|
func New() *ProductService {
|
|
return &ProductService{
|
|
productsRepo: productsRepo.New(),
|
|
}
|
|
}
|
|
|
|
func (s *ProductService) GetJSON(p_id_product, p_id_lang, p_id_customer, b2b_id_country, p_quantity int) (*json.RawMessage, error) {
|
|
products, err := s.productsRepo.GetJSON(p_id_product, constdata.SHOP_ID, p_id_lang, p_id_customer, b2b_id_country, p_quantity)
|
|
if err != nil {
|
|
return products, err
|
|
}
|
|
|
|
return products, nil
|
|
}
|
|
|
|
func (s *ProductService) Find(id_lang uint, p find.Paging, filters *filters.FiltersList) (find.Found[model.ProductInList], error) {
|
|
return s.productsRepo.Find(id_lang, p, filters)
|
|
}
|