@sportsbroker/firebase-structure 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/firestore/b2b-bet-events/b2b-bet-events.model.ts +17 -20
- package/firestore/b2b-bets/b2b-bets.model.ts +1 -43
- package/firestore/b2b-question-sets/b2b-question.d.ts +1 -0
- package/firestore/{match-predictor/match-predictor-question.d.ts → b2b-question-sets/b2b-question.model.ts} +5 -5
- package/firestore/b2b-question-sets/index.ts +1 -0
- package/package.json +1 -1
- package/firestore/match-predictor/index.ts +0 -2
- package/firestore/match-predictor/match-predictor.d.ts +0 -56
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B2BPool } from "../b2b-pools";
|
|
2
|
+
import { Question } from "../b2b-question-sets";
|
|
2
3
|
import type { ISODate, UUID } from "../common";
|
|
3
|
-
import type { MPQuestion } from "../match-predictor";
|
|
4
4
|
|
|
5
5
|
export type B2BBetEvent = {
|
|
6
6
|
id: string;
|
|
@@ -8,18 +8,17 @@ export type B2BBetEvent = {
|
|
|
8
8
|
status: B2BBetEventStatusType;
|
|
9
9
|
bettingStatus: B2BBetEventBettingStatusType;
|
|
10
10
|
engine: GameEngineEnum;
|
|
11
|
-
gameSpecificData:
|
|
11
|
+
gameSpecificData: B2BEventGameSpecificData;
|
|
12
12
|
resultsData: ResultsData;
|
|
13
13
|
poolData: B2BPool;
|
|
14
14
|
createdAt: ISODate;
|
|
15
15
|
updatedAt: ISODate;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export type ResultsData =
|
|
18
|
+
export type ResultsData = B2BEventResultsData;
|
|
19
19
|
|
|
20
20
|
export enum GameEngineEnum {
|
|
21
21
|
MATCH_PREDICTOR = "match-predictor",
|
|
22
|
-
SCORE_PREDICTOR = "score-predictor",
|
|
23
22
|
EDGE = "edge"
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -34,20 +33,18 @@ export type B2BBetEventStatusType =
|
|
|
34
33
|
| "finished" // event is finished and settled
|
|
35
34
|
| "cancelled"; // event is cancelled
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export type B2BMPEventGameSpecificData = {
|
|
36
|
+
export type B2BEventGameSpecificData = {
|
|
40
37
|
matchId: UUID;
|
|
41
|
-
questions:
|
|
38
|
+
questions: Question[];
|
|
42
39
|
};
|
|
43
40
|
|
|
44
|
-
export type
|
|
45
|
-
[
|
|
41
|
+
export type B2BEventResultsData = {
|
|
42
|
+
[questionKey: QuestionKey]: B2BEventResultData;
|
|
46
43
|
};
|
|
47
44
|
|
|
48
|
-
export type
|
|
45
|
+
export type QuestionKey = `${QuestionKeyEnum}` | string;
|
|
49
46
|
|
|
50
|
-
export enum
|
|
47
|
+
export enum QuestionKeyEnum {
|
|
51
48
|
MATCH_SCORE = "match-score",
|
|
52
49
|
TOTAL_SHOTS_ON_TARGET = "total-shots-on-target",
|
|
53
50
|
TOTAL_CARDS = "total-cards",
|
|
@@ -61,18 +58,18 @@ export enum MPQuestionKeyEnum {
|
|
|
61
58
|
CORNERS_10_OR_MORE = "corners-10-or-more",
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
export type
|
|
61
|
+
export type B2BEventResultData = Question & {
|
|
65
62
|
result: {
|
|
66
63
|
isFinal: boolean;
|
|
67
|
-
value:
|
|
64
|
+
value: QuestionResultTypeValueType[QuestionResultTypeEnum];
|
|
68
65
|
};
|
|
69
66
|
};
|
|
70
67
|
|
|
71
|
-
export type
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
68
|
+
export type QuestionResultTypeValueType = {
|
|
69
|
+
[QuestionResultTypeEnum.BOTH_SIDES_POSITIVE_INTEGER]: BothSidesPositiveInteger;
|
|
70
|
+
[QuestionResultTypeEnum.POSITIVE_INTEGER]: PositiveInteger;
|
|
71
|
+
[QuestionResultTypeEnum.MATCH_SIDE_RESULT]: MatchSideResultEnum;
|
|
72
|
+
[QuestionResultTypeEnum.YES_NO]: YesNoResultEnum;
|
|
76
73
|
};
|
|
77
74
|
|
|
78
75
|
export enum MatchSideResultEnum {
|
|
@@ -87,7 +84,7 @@ export enum YesNoResultEnum {
|
|
|
87
84
|
export type BothSidesPositiveInteger = { home: number; away: number };
|
|
88
85
|
export type PositiveInteger = number;
|
|
89
86
|
|
|
90
|
-
export enum
|
|
87
|
+
export enum QuestionResultTypeEnum {
|
|
91
88
|
BOTH_SIDES_POSITIVE_INTEGER = "both-sides-positive-integer",
|
|
92
89
|
POSITIVE_INTEGER = "positive-integer",
|
|
93
90
|
MATCH_SIDE_RESULT = "match-side-result",
|
|
@@ -23,34 +23,13 @@ export enum BetStatusEnum {
|
|
|
23
23
|
LOCKED = "locked",
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export type BetPredictionType =
|
|
27
|
-
|
|
28
|
-
export type MPPrediction = {
|
|
29
|
-
questionKey: MPQuestionKeyEnum;
|
|
30
|
-
predictionValue: MPQuestionResultTypeValueType[MPQuestionResultTypeEnum];
|
|
31
|
-
};
|
|
26
|
+
export type BetPredictionType = Prediction;
|
|
32
27
|
|
|
33
28
|
export type Prediction = {
|
|
34
29
|
eventQuestionId: UUID;
|
|
35
30
|
predictionValue: QuestionResultValue;
|
|
36
31
|
};
|
|
37
32
|
|
|
38
|
-
export enum MPQuestionKeyEnum {
|
|
39
|
-
MATCH_SCORE = "match-score",
|
|
40
|
-
TOTAL_SHOTS_ON_TARGET = "total-shots-on-target",
|
|
41
|
-
TOTAL_CARDS = "total-cards",
|
|
42
|
-
// MATCH_RESULT = 'match-result',
|
|
43
|
-
RED_CARD_IS_GIVEN = "red-card-is-given",
|
|
44
|
-
PENALTY_AWARDED = "penalty-awarded",
|
|
45
|
-
// BOTH_TEAM_SCORE = 'both-team-score',
|
|
46
|
-
// GOAL_IN_BOTH_HALVES = 'goal-in-both-halves',
|
|
47
|
-
GOAL_IN_FIRST_15 = "goal-in-first-15",
|
|
48
|
-
MOST_TACKLES_WON = "most-tackles-won",
|
|
49
|
-
CORNERS_10_OR_MORE = "corners-10-or-more",
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// export type MPQuestionKeyType = keyof typeof MPQuestionKeyEnum;
|
|
53
|
-
|
|
54
33
|
export enum MatchSideResultEnum {
|
|
55
34
|
HOME = "home",
|
|
56
35
|
AWAY = "away",
|
|
@@ -63,25 +42,4 @@ export enum YesNoResultEnum {
|
|
|
63
42
|
export type BothSidesPositiveInteger = { home: number; away: number };
|
|
64
43
|
export type PositiveInteger = number;
|
|
65
44
|
|
|
66
|
-
export enum MPQuestionResultTypeEnum {
|
|
67
|
-
BOTH_SIDES_POSITIVE_INTEGER = "both-sides-positive-integer",
|
|
68
|
-
POSITIVE_INTEGER = "positive-integer",
|
|
69
|
-
MATCH_SIDE_RESULT = "match-side-result",
|
|
70
|
-
YES_NO = "yes-no",
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export type MPQuestionResultTypeType = keyof typeof MPQuestionResultTypeEnum;
|
|
74
45
|
|
|
75
|
-
export type MPQuestion = {
|
|
76
|
-
key: MPQuestionKeyEnum;
|
|
77
|
-
points: number;
|
|
78
|
-
resultValueType: MPQuestionResultTypeEnum;
|
|
79
|
-
displayOrder: number;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export type MPQuestionResultTypeValueType = {
|
|
83
|
-
[MPQuestionResultTypeEnum.BOTH_SIDES_POSITIVE_INTEGER]: BothSidesPositiveInteger;
|
|
84
|
-
[MPQuestionResultTypeEnum.POSITIVE_INTEGER]: PositiveInteger;
|
|
85
|
-
[MPQuestionResultTypeEnum.MATCH_SIDE_RESULT]: MatchSideResultEnum;
|
|
86
|
-
[MPQuestionResultTypeEnum.YES_NO]: YesNoResultEnum;
|
|
87
|
-
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./b2b-question.model";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export type
|
|
2
|
-
key:
|
|
1
|
+
export type Question = {
|
|
2
|
+
key: QuestionKey;
|
|
3
3
|
points: number;
|
|
4
|
-
resultValueType:
|
|
4
|
+
resultValueType: QuestionResultType;
|
|
5
5
|
displayOrder: number;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type QuestionKey =
|
|
9
9
|
| "match-score"
|
|
10
10
|
| "total-shots-on-target"
|
|
11
11
|
| "total-cards"
|
|
@@ -18,7 +18,7 @@ export type MPQuestionKey =
|
|
|
18
18
|
| "most-tackles-won"
|
|
19
19
|
| "corners-10-or-more";
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type QuestionResultType =
|
|
22
22
|
| "both-sides-positive-integer"
|
|
23
23
|
| "positive-integer"
|
|
24
24
|
| "match-side-result"
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Doc, ISODate, UUID } from "../common";
|
|
2
|
-
import { MatchTime } from "../matches";
|
|
3
|
-
import { MPQuestion } from "./match-predictor-question";
|
|
4
|
-
|
|
5
|
-
export type MPEventDoc = MPEvent & Doc;
|
|
6
|
-
|
|
7
|
-
export interface MPEvent {
|
|
8
|
-
id: UUID;
|
|
9
|
-
status: MPEventStatusType;
|
|
10
|
-
startDate: string; // ISO DATE STRING
|
|
11
|
-
matchData: MPMatchData;
|
|
12
|
-
questions: MPQuestion[];
|
|
13
|
-
pools: { [key: string]: MPEventPool };
|
|
14
|
-
createdAt: ISODate;
|
|
15
|
-
updatedAt: ISODate;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type MPEventMatchStatusType =
|
|
19
|
-
| "pre-event"
|
|
20
|
-
| "live"
|
|
21
|
-
| "finished"
|
|
22
|
-
| "cancelled";
|
|
23
|
-
|
|
24
|
-
export type MPMatchData = {
|
|
25
|
-
matchId: UUID;
|
|
26
|
-
status: MPEventMatchStatusType;
|
|
27
|
-
startDate: ISODate;
|
|
28
|
-
homeTeamName: string;
|
|
29
|
-
homeTeamId: UUID | null;
|
|
30
|
-
awayTeamName: string;
|
|
31
|
-
awayTeamId: UUID | null;
|
|
32
|
-
score: { home: number; away: number };
|
|
33
|
-
isActive: boolean;
|
|
34
|
-
isPostponed?: boolean;
|
|
35
|
-
matchTime: MatchTime;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type MPEventStatusType =
|
|
39
|
-
| "pending"
|
|
40
|
-
| "open"
|
|
41
|
-
| "event-in-progress"
|
|
42
|
-
| "waiting-for-results-approval"
|
|
43
|
-
| "results-approved"
|
|
44
|
-
| "finished"
|
|
45
|
-
| "cancelled";
|
|
46
|
-
|
|
47
|
-
export type MPEventPool = {
|
|
48
|
-
id: UUID;
|
|
49
|
-
potAmount: number; // gross pool entries sum aka prize pool
|
|
50
|
-
participants: number; // active bets count
|
|
51
|
-
entryFee: number;
|
|
52
|
-
leaderboardId: UUID;
|
|
53
|
-
payoutStructure: MPPoolPayoutStructure;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type MPPoolPayoutStructure = { [position: string]: number };
|