Yimaru-BackEnd/internal/domain/result.go
Samuel Tariku e49ff366d5 feat: Implement wallet notification system and refactor related services
- Added new notification handling in the wallet service to notify admins when wallet balances are low or insufficient.
- Created a new file for wallet notifications and moved relevant functions from the wallet service to this new file.
- Updated the wallet service to publish wallet events including wallet type.
- Refactored the client code to improve readability and maintainability.
- Enhanced the bet handler to support pagination and status filtering for bets.
- Updated routes and handlers for user search functionality to improve clarity and organization.
- Modified cron job scheduling to comment out unused jobs for clarity.
- Updated the WebSocket broadcast to include wallet type in notifications.
- Adjusted the makefile to include Kafka in the docker-compose setup for local development.
2025-09-25 21:26:24 +03:00

101 lines
2.1 KiB
Go

package domain
import (
"time"
"github.com/jackc/pgx/v5/pgtype"
)
type MarketConfig struct {
Sport string
MarketCategories map[string]bool
MarketTypes map[int64]bool
}
type Result struct {
ID int64
BetOutcomeID int64
EventID int64
OddID int64
MarketID int64
Status OutcomeStatus
Score string
FullTimeScore string
HalfTimeScore string
SS string
Scores map[string]ScoreResultResponse
CreatedAt time.Time
UpdatedAt time.Time
}
type CreateResult struct {
BetOutcomeID int64
EventID int64
OddID int64
MarketID int64
Status OutcomeStatus
Score string
}
type OutcomeStatus int32
const (
OUTCOME_STATUS_PENDING OutcomeStatus = 0
OUTCOME_STATUS_WIN OutcomeStatus = 1
OUTCOME_STATUS_LOSS OutcomeStatus = 2
OUTCOME_STATUS_VOID OutcomeStatus = 3 //Give Back
OUTCOME_STATUS_HALF OutcomeStatus = 4 //Half Win and Half Given Back
OUTCOME_STATUS_ERROR OutcomeStatus = 5 //Half Win and Half Given Back
)
func (o *OutcomeStatus) String() string {
switch *o {
case OUTCOME_STATUS_PENDING:
return "PENDING"
case OUTCOME_STATUS_WIN:
return "WIN"
case OUTCOME_STATUS_LOSS:
return "LOSS"
case OUTCOME_STATUS_VOID:
return "VOID"
case OUTCOME_STATUS_HALF:
return "HALF"
case OUTCOME_STATUS_ERROR:
return "ERROR"
default:
return "UNKNOWN"
}
}
type ValidOutcomeStatus struct {
Value OutcomeStatus
Valid bool
}
func (v ValidOutcomeStatus) ToPG() pgtype.Int4 {
return pgtype.Int4{
Int32: int32(v.Value),
Valid: v.Valid,
}
}
type TimeStatus int32
const (
TIME_STATUS_NOT_STARTED TimeStatus = 0
TIME_STATUS_IN_PLAY TimeStatus = 1
TIME_STATUS_TO_BE_FIXED TimeStatus = 2
TIME_STATUS_ENDED TimeStatus = 3
TIME_STATUS_POSTPONED TimeStatus = 4
TIME_STATUS_CANCELLED TimeStatus = 5
TIME_STATUS_WALKOVER TimeStatus = 6
TIME_STATUS_INTERRUPTED TimeStatus = 7
TIME_STATUS_ABANDONED TimeStatus = 8
TIME_STATUS_RETIRED TimeStatus = 9
TIME_STATUS_SUSPENDED TimeStatus = 10
TIME_STATUS_DECIDED_BY_FA TimeStatus = 11
TIME_STATUS_REMOVED TimeStatus = 99
)