- Removed detailed event routes from the API. - Added new report request routes for creating and fetching report requests. - Introduced new domain models for report requests, including metadata and status handling. - Implemented report request processing logic, including CSV generation for event interval reports. - Enhanced company statistics handling with new domain models and service methods. - Updated repository interfaces and implementations to support new report functionalities. - Added error handling and logging for report file operations and notifications.
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package league
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/repository"
|
|
)
|
|
|
|
type Service struct {
|
|
store *repository.Store
|
|
}
|
|
|
|
func New(store *repository.Store) *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)
|
|
}
|