Yimaru-BackEnd/internal/services/bet/service.go

36 lines
854 B
Go

package bet
import (
"context"
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
)
type Service struct {
betStore BetStore
}
func NewService(betStore BetStore) *Service {
return &Service{
betStore: betStore,
}
}
func (s *Service) CreateBet(ctx context.Context, bet domain.CreateBet) (domain.Bet, error) {
return s.betStore.CreateBet(ctx, bet)
}
func (s *Service) GetBetByID(ctx context.Context, id int64) (domain.Bet, error) {
return s.betStore.GetBetByID(ctx, id)
}
func (s *Service) GetAllBets(ctx context.Context) ([]domain.Bet, error) {
return s.betStore.GetAllBets(ctx)
}
func (s *Service) UpdateCashOut(ctx context.Context, id int64, cashedOut bool) error {
return s.betStore.UpdateCashOut(ctx, id, cashedOut)
}
func (s *Service) DeleteBet(ctx context.Context, id int64) error {
return s.betStore.DeleteBet(ctx, id)
}