163 lines
5.4 KiB
Go
163 lines
5.4 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
dbgen "github.com/SamuelTariku/FortuneBet-Backend/gen/db"
|
|
)
|
|
|
|
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]Score
|
|
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 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
|
|
)
|
|
|
|
type ResultLog struct {
|
|
ID int64 `json:"id"`
|
|
StatusNotFinishedCount int `json:"status_not_finished_count"`
|
|
StatusNotFinishedBets int `json:"status_not_finished_bets"`
|
|
StatusToBeFixedCount int `json:"status_to_be_fixed_count"`
|
|
StatusToBeFixedBets int `json:"status_to_be_fixed_bets"`
|
|
StatusPostponedCount int `json:"status_postponed_count"`
|
|
StatusPostponedBets int `json:"status_postponed_bets"`
|
|
StatusEndedCount int `json:"status_ended_count"`
|
|
StatusEndedBets int `json:"status_ended_bets"`
|
|
StatusRemovedCount int `json:"status_removed_count"`
|
|
StatusRemovedBets int `json:"status_removed_bets"`
|
|
RemovedCount int `json:"removed"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type CreateResultLog struct {
|
|
StatusNotFinishedCount int `json:"status_not_finished_count"`
|
|
StatusNotFinishedBets int `json:"status_not_finished_bets"`
|
|
StatusToBeFixedCount int `json:"status_to_be_fixed_count"`
|
|
StatusToBeFixedBets int `json:"status_to_be_fixed_bets"`
|
|
StatusPostponedCount int `json:"status_postponed_count"`
|
|
StatusPostponedBets int `json:"status_postponed_bets"`
|
|
StatusEndedCount int `json:"status_ended_count"`
|
|
StatusEndedBets int `json:"status_ended_bets"`
|
|
StatusRemovedCount int `json:"status_removed_count"`
|
|
StatusRemovedBets int `json:"status_removed_bets"`
|
|
RemovedCount int `json:"removed"`
|
|
}
|
|
|
|
type ResultFilter struct {
|
|
CreatedBefore ValidTime
|
|
CreatedAfter ValidTime
|
|
}
|
|
type ResultStatusBets struct {
|
|
StatusNotFinished []int64 `json:"status_not_finished"`
|
|
StatusToBeFixed []int64 `json:"status_to_be_fixed"`
|
|
StatusPostponed []int64 `json:"status_postponed"`
|
|
StatusEnded []int64 `json:"status_ended"`
|
|
StatusRemoved []int64 `json:"status_removed"`
|
|
}
|
|
|
|
func ConvertDBResultLog(result dbgen.ResultLog) ResultLog {
|
|
return ResultLog{
|
|
ID: result.ID,
|
|
StatusNotFinishedCount: int(result.StatusNotFinishedCount),
|
|
StatusNotFinishedBets: int(result.StatusNotFinishedBets),
|
|
StatusToBeFixedCount: int(result.StatusToBeFixedCount),
|
|
StatusToBeFixedBets: int(result.StatusToBeFixedBets),
|
|
StatusPostponedCount: int(result.StatusPostponedCount),
|
|
StatusPostponedBets: int(result.StatusPostponedBets),
|
|
StatusEndedCount: int(result.StatusEndedCount),
|
|
StatusEndedBets: int(result.StatusEndedBets),
|
|
StatusRemovedCount: int(result.StatusRemovedCount),
|
|
StatusRemovedBets: int(result.StatusRemovedBets),
|
|
RemovedCount: int(result.RemovedCount),
|
|
CreatedAt: result.CreatedAt.Time,
|
|
}
|
|
}
|
|
|
|
func ConvertCreateResultLog(result CreateResultLog) dbgen.CreateResultLogParams {
|
|
return dbgen.CreateResultLogParams{
|
|
StatusNotFinishedCount: int32(result.StatusNotFinishedCount),
|
|
StatusNotFinishedBets: int32(result.StatusNotFinishedBets),
|
|
StatusToBeFixedCount: int32(result.StatusToBeFixedCount),
|
|
StatusToBeFixedBets: int32(result.StatusToBeFixedBets),
|
|
StatusPostponedCount: int32(result.StatusPostponedCount),
|
|
StatusPostponedBets: int32(result.StatusPostponedBets),
|
|
StatusEndedCount: int32(result.StatusEndedCount),
|
|
StatusEndedBets: int32(result.StatusEndedBets),
|
|
StatusRemovedCount: int32(result.StatusRemovedCount),
|
|
StatusRemovedBets: int32(result.StatusRemovedBets),
|
|
RemovedCount: int32(result.RemovedCount),
|
|
}
|
|
}
|