48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package league
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/ports"
|
|
|
|
)
|
|
|
|
type Service struct {
|
|
store ports.LeagueStore
|
|
}
|
|
|
|
func New(store ports.LeagueStore) *Service {
|
|
return &Service{
|
|
store: store,
|
|
}
|
|
}
|
|
|
|
func (s *Service) SaveLeague(ctx context.Context, league domain.CreateLeague) error {
|
|
return s.store.SaveLeague(ctx, league)
|
|
}
|
|
|
|
func (s *Service) SaveLeagueSettings(ctx context.Context, leagueSettings domain.CreateLeagueSettings) error {
|
|
return s.store.SaveLeagueSettings(ctx, leagueSettings)
|
|
}
|
|
|
|
func (s *Service) GetAllLeagues(ctx context.Context, filter domain.LeagueFilter) ([]domain.BaseLeague, int64, error) {
|
|
return s.store.GetAllLeagues(ctx, filter)
|
|
}
|
|
|
|
func (s *Service) GetAllLeaguesByCompany(ctx context.Context, companyID int64, filter domain.LeagueFilter) ([]domain.LeagueWithSettings, int64, error) {
|
|
return s.store.GetAllLeaguesByCompany(ctx, companyID, filter)
|
|
}
|
|
|
|
func (s *Service) CheckLeagueSupport(ctx context.Context, leagueID int64, companyID int64) (bool, error) {
|
|
return s.store.CheckLeagueSupport(ctx, leagueID, companyID)
|
|
}
|
|
|
|
func (s *Service) UpdateLeague(ctx context.Context, league domain.UpdateLeague) error {
|
|
return s.store.UpdateLeague(ctx, league)
|
|
}
|
|
|
|
func (s *Service) UpdateGlobalLeagueSettings(ctx context.Context, league domain.UpdateGlobalLeagueSettings) error {
|
|
return s.store.UpdateGlobalLeagueSettings(ctx, league)
|
|
}
|