Yimaru-BackEnd/internal/services/bet/port.go
Samuel Tariku 3dfa1255b0 Refactor result notification service and remove redundant code
- Removed the CheckAndSendResultNotifications method from the result service.
- Consolidated notification logic into a new notification.go file.
- Updated email and in-app notification formatting to include event processing periods.
- Added error handling for wallet operations to check if wallets are active before processing transfers.
- Introduced new error for disabled wallets.
- Updated cron jobs to comment out unnecessary tasks.
- Added bulk update functionality for bet outcomes by odd IDs in the odd handler.
- Renamed ticket handler methods for clarity and consistency.
- Updated API version in routes.
2025-10-10 14:59:19 +03:00

54 lines
3.3 KiB
Go

package bet
import (
"context"
"time"
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
)
type BetStore interface {
CreateBet(ctx context.Context, bet domain.CreateBet) (domain.Bet, error)
CreateBetOutcome(ctx context.Context, outcomes []domain.CreateBetOutcome) (int64, error)
CreateFlag(ctx context.Context, flag domain.CreateFlagReq) (domain.Flag, error)
GetBetByID(ctx context.Context, id int64) (domain.GetBet, error)
GetAllBets(ctx context.Context, filter domain.BetFilter) ([]domain.GetBet, int64, error)
GetBetByUserID(ctx context.Context, UserID int64) ([]domain.GetBet, error)
GetBetByFastCode(ctx context.Context, fastcode string) (domain.GetBet, error)
GetBetOutcomeViewByEventID(ctx context.Context, eventID int64, filter domain.BetOutcomeViewFilter) ([]domain.BetOutcomeViewRes, int64, error)
GetBetOutcomeByEventID(ctx context.Context, eventID int64, is_filtered bool) ([]domain.BetOutcome, error)
GetBetOutcomeByBetID(ctx context.Context, betID int64) ([]domain.BetOutcome, error)
GetBetOutcomeCountByOddID(ctx context.Context, oddID int64) (int64, error)
GetBetCountByUserID(ctx context.Context, userID int64, outcomesHash string) (int64, error)
GetBetCountByOutcomesHash(ctx context.Context, outcomesHash string) (int64, error)
UpdateCashOut(ctx context.Context, id int64, cashedOut bool) error
UpdateStatus(ctx context.Context, id int64, status domain.OutcomeStatus) error
UpdateBetOutcomeStatus(ctx context.Context, id int64, status domain.OutcomeStatus) (domain.BetOutcome, error)
UpdateBetOutcomeStatusByBetID(ctx context.Context, id int64, status domain.OutcomeStatus) (domain.BetOutcome, error)
UpdateBetOutcomeStatusForEvent(ctx context.Context, eventID int64, status domain.OutcomeStatus) ([]domain.BetOutcome, error)
UpdateBetOutcomeStatusForOddId(ctx context.Context, oddID int64, status domain.OutcomeStatus) ([]domain.BetOutcome, error)
BulkUpdateBetOutcomeStatusForOddIds(ctx context.Context, oddID []int64, status domain.OutcomeStatus) error
GetBetSummary(ctx context.Context, filter domain.ReportFilter) (
totalStakes domain.Currency,
totalBets int64,
activeBets int64,
totalWins int64,
totalLosses int64,
winBalance domain.Currency,
err error,
)
GetBetStats(ctx context.Context, filter domain.ReportFilter) ([]domain.BetStat, error)
GetSportPopularity(ctx context.Context, filter domain.ReportFilter) (map[time.Time]string, error)
GetMarketPopularity(ctx context.Context, filter domain.ReportFilter) (map[time.Time]string, error)
GetExtremeValues(ctx context.Context, filter domain.ReportFilter) (map[time.Time]domain.ExtremeValues, error)
GetCustomerBetActivity(ctx context.Context, filter domain.ReportFilter) ([]domain.CustomerBetActivity, error)
GetCustomerPreferences(ctx context.Context, filter domain.ReportFilter) (map[int64]domain.CustomerPreferences, error)
GetBranchBetActivity(ctx context.Context, filter domain.ReportFilter) ([]domain.BranchBetActivity, error)
GetSportBetActivity(ctx context.Context, filter domain.ReportFilter) ([]domain.SportBetActivity, error)
GetSportDetails(ctx context.Context, filter domain.ReportFilter) (map[string]string, error)
GetSportMarketPopularity(ctx context.Context, filter domain.ReportFilter) (map[string]string, error)
GetBetsForCashback(ctx context.Context) ([]domain.GetBet, error)
UpdateBetWithCashback(ctx context.Context, betID int64, cashbackStatus bool) error
}