package services import ( "nearle/models" "nearle/repositories" ) type CatalogueService interface { GetBrands() ([]models.CatalogueBrand, error) GetCategories(brand string) ([]string, error) 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) } type catalogueService struct { repo repositories.CatalogueRepository } func NewCatalogueService(repo repositories.CatalogueRepository) CatalogueService { return &catalogueService{repo: repo} } func (s *catalogueService) GetBrands() ([]models.CatalogueBrand, error) { return s.repo.GetBrands() } func (s *catalogueService) GetCategories(brand string) ([]string, error) { return s.repo.GetCategories(brand) } func (s *catalogueService) GetProducts(brand, category, keyword string, pageno, pagesize int) ([]models.CatalogueProduct, int64, error) { return s.repo.GetProducts(brand, category, keyword, pageno, pagesize) } func (s *catalogueService) GetProductBySKU(brand, sku string) (*models.CatalogueProduct, error) { return s.repo.GetProductBySKU(brand, sku) } func (s *catalogueService) GetProductByID(brand string, id int64) (*models.CatalogueProduct, error) { return s.repo.GetProductByID(brand, id) }