@sportsbroker/firebase-structure 5.1.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.
@@ -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: B2BMPEventGameSpecificData;
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 = B2BMPEventResultsData;
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
 
@@ -32,22 +31,20 @@ export type B2BBetEventStatusType =
32
31
  | "waiting-for-results-approval" // match is finished and we wait for CSA to approve match results
33
32
  | "results-approved" // results are approved and event is ready to be settled
34
33
  | "finished" // event is finished and settled
35
- | "canceled"; // event is canceled
34
+ | "cancelled"; // event is cancelled
36
35
 
37
- ////////////////////////////////////// MATCH PREDICTOR SPECIFIC TYPES //////////////////////////////////////
38
-
39
- export type B2BMPEventGameSpecificData = {
36
+ export type B2BEventGameSpecificData = {
40
37
  matchId: UUID;
41
- questions: MPQuestion[];
38
+ questions: Question[];
42
39
  };
43
40
 
44
- export type B2BMPEventResultsData = {
45
- [mpQuestionKey: MPQuestionKeyType]: B2BMPEventResultData;
41
+ export type B2BEventResultsData = {
42
+ [questionKey: QuestionKey]: B2BEventResultData;
46
43
  };
47
44
 
48
- export type MPQuestionKeyType = `${MPQuestionKeyEnum}` | string;
45
+ export type QuestionKey = `${QuestionKeyEnum}` | string;
49
46
 
50
- export enum MPQuestionKeyEnum {
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 B2BMPEventResultData = MPQuestion & {
61
+ export type B2BEventResultData = Question & {
65
62
  result: {
66
63
  isFinal: boolean;
67
- value: MPQuestionResultTypeValueType[MPQuestionResultTypeEnum];
64
+ value: QuestionResultTypeValueType[QuestionResultTypeEnum];
68
65
  };
69
66
  };
70
67
 
71
- export type MPQuestionResultTypeValueType = {
72
- [MPQuestionResultTypeEnum.BOTH_SIDES_POSITIVE_INTEGER]: BothSidesPositiveInteger;
73
- [MPQuestionResultTypeEnum.POSITIVE_INTEGER]: PositiveInteger;
74
- [MPQuestionResultTypeEnum.MATCH_SIDE_RESULT]: MatchSideResultEnum;
75
- [MPQuestionResultTypeEnum.YES_NO]: YesNoResultEnum;
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 MPQuestionResultTypeEnum {
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",
@@ -19,38 +19,17 @@ export enum BetStatusEnum {
19
19
  PENDING = "pending",
20
20
  WON = "won",
21
21
  LOST = "lost",
22
- CANCELED = "cancelled",
22
+ CANCELLED = "cancelled",
23
23
  LOCKED = "locked",
24
24
  }
25
25
 
26
- export type BetPredictionType = MPPrediction | Prediction;
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 MPQuestion = {
2
- key: MPQuestionKey;
1
+ export type Question = {
2
+ key: QuestionKey;
3
3
  points: number;
4
- resultValueType: MPQuestionResultType;
4
+ resultValueType: QuestionResultType;
5
5
  displayOrder: number;
6
6
  };
7
7
 
8
- export type MPQuestionKey =
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 MPQuestionResultType =
21
+ export type QuestionResultType =
22
22
  | "both-sides-positive-integer"
23
23
  | "positive-integer"
24
24
  | "match-side-result"
@@ -1 +1,2 @@
1
1
  export * from "./b2b-question-sets.model";
2
+ export * from "./b2b-question.model";
@@ -19,7 +19,7 @@ export type SPEventMatchStatusType =
19
19
  | "pre-event"
20
20
  | "live"
21
21
  | "finished"
22
- | "canceled";
22
+ | "cancelled";
23
23
 
24
24
  export type SPMatchesData = {
25
25
  [matchId: string]: {
@@ -68,7 +68,7 @@ export type SPEventStatusType =
68
68
  | "waiting-for-results-approval"
69
69
  | "results-approved"
70
70
  | "finished"
71
- | "canceled";
71
+ | "cancelled";
72
72
 
73
73
  export type SPEventPool = {
74
74
  id: UUID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- export * from "./match-predictor";
2
- export * from "./match-predictor-question";
@@ -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
- | "canceled";
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
- | "canceled";
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 };