- Updated league handling to ensure valid page size checks and improved error handling for sport ID parsing. - Introduced new endpoint to update global league settings with comprehensive validation and error logging. - Refactored odds settings management, including saving, removing, and updating odds settings with enhanced validation. - Added tenant slug retrieval by token, ensuring proper user and company validation. - Improved middleware to check for active company status and adjusted route permissions for various endpoints. - Added SQL script to fix auto-increment desynchronization across multiple tables.
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package company
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
)
|
|
|
|
type Service struct {
|
|
companyStore CompanyStore
|
|
}
|
|
|
|
func NewService(companyStore 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) (domain.Company, error) {
|
|
return s.companyStore.UpdateCompany(ctx, company)
|
|
}
|
|
func (s *Service) DeleteCompany(ctx context.Context, id int64) error {
|
|
return s.companyStore.DeleteCompany(ctx, id)
|
|
}
|