44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package company
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/ports"
|
|
)
|
|
|
|
type Service struct {
|
|
companyStore ports.CompanyStore
|
|
}
|
|
|
|
func NewService(companyStore ports.CompanyStore) *Service {
|
|
return &Service{
|
|
companyStore: companyStore,
|
|
}
|
|
}
|
|
|
|
func (s *Service) CreateCompany(ctx context.Context, company domain.CreateCompany) (domain.Company, error) {
|
|
return s.companyStore.CreateCompany(ctx, company)
|
|
}
|
|
func (s *Service) GetAllCompanies(ctx context.Context, filter domain.CompanyFilter) ([]domain.GetCompany, error) {
|
|
return s.companyStore.GetAllCompanies(ctx, filter)
|
|
}
|
|
|
|
func (s *Service) GetCompanyByID(ctx context.Context, id int64) (domain.GetCompany, error) {
|
|
return s.companyStore.GetCompanyByID(ctx, id)
|
|
}
|
|
func (s *Service) GetCompanyBySlug(ctx context.Context, slug string) (domain.Company, error) {
|
|
return s.companyStore.GetCompanyBySlug(ctx, slug)
|
|
}
|
|
|
|
func (s *Service) SearchCompanyByName(ctx context.Context, name string) ([]domain.GetCompany, error) {
|
|
return s.companyStore.SearchCompanyByName(ctx, name)
|
|
}
|
|
|
|
func (s *Service) UpdateCompany(ctx context.Context, company domain.UpdateCompany) (error) {
|
|
return s.companyStore.UpdateCompany(ctx, company)
|
|
}
|
|
func (s *Service) DeleteCompany(ctx context.Context, id int64) error {
|
|
return s.companyStore.DeleteCompany(ctx, id)
|
|
}
|