@sportsbroker/firebase-structure 9.2.0 → 9.4.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.
|
@@ -29,25 +29,54 @@ export type Pool = {
|
|
|
29
29
|
prizeDistributionStrategy: PrizeDistributionStrategyEnum;
|
|
30
30
|
track?: PoolTrack;
|
|
31
31
|
teamKits?: PoolTeamKits;
|
|
32
|
+
/**
|
|
33
|
+
* The provider brand the pool serves, for an operator that keeps pools per brand: an aggregator (Bragg)
|
|
34
|
+
* whose one operator serves many casinos. Players of two brands never share a pool, so a client of a
|
|
35
|
+
* brand session lists only the pools of its own brand, `where('brand', '==', brand)` next to the
|
|
36
|
+
* operator filter. Each such list query needs its composite index in the Firebase project.
|
|
37
|
+
*
|
|
38
|
+
* Absent for every other operator, and for their documents nothing changes. Omitting it is safe under
|
|
39
|
+
* the merge write that `teamKits` has to guard against: a pool keeps the brand it was created with for
|
|
40
|
+
* its whole life, so no document is ever left holding a brand it lost.
|
|
41
|
+
*/
|
|
42
|
+
brand?: string;
|
|
32
43
|
};
|
|
33
44
|
|
|
34
45
|
/**
|
|
35
|
-
* The
|
|
46
|
+
* The shirts to draw for the teams taking part in this pool.
|
|
36
47
|
*
|
|
37
|
-
*
|
|
38
|
-
* prediction or score-predictor pool runs over several fixtures and therefore over several teams
|
|
39
|
-
*
|
|
40
|
-
*
|
|
48
|
+
* One entry per team that HAS a shirt, never an entry per team. A pool is not one match - a
|
|
49
|
+
* prediction or score-predictor pool runs over several fixtures and therefore over several teams -
|
|
50
|
+
* so this covers all of them at once. The ids are the same ones the `Fixtures` documents named
|
|
51
|
+
* under `matchIds`, so a client joins what it already read.
|
|
41
52
|
*
|
|
42
53
|
* It lives on the POOL and not on the fixture because a shirt is one operator's choice: a fixture
|
|
43
54
|
* document is shared by every operator running that match, and could not carry a per-operator
|
|
44
55
|
* answer. The pool is the only document that knows whose it is.
|
|
45
56
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
57
|
+
* A LIST and not a map, which is a storage fact rather than a taste. Pool documents are written
|
|
58
|
+
* with a merge, and a merge DEEP-merges a nested map: a shirt that was removed, repointed at
|
|
59
|
+
* another team, or keyed to a team that has since left a hand-entered fixture would stay in that
|
|
60
|
+
* map for ever, because a write that stops naming a key does not remove it. A list is replaced
|
|
61
|
+
* whole, so what was written last is what a player sees. A client that wants lookup by id builds
|
|
62
|
+
* its own map once.
|
|
63
|
+
*
|
|
64
|
+
* Optional to READ, always written. A team with no shirt has no entry, and a pool whose teams have
|
|
65
|
+
* none carries an EMPTY list rather than no field: a write that simply stopped sending the field
|
|
66
|
+
* would leave the previous list in place, for the same merge reason as above. So presence means
|
|
67
|
+
* nothing and length means everything - a client checks whether the list has an entry for the team
|
|
68
|
+
* it is drawing, and draws what it drew before when it has not. It stays optional on the type
|
|
69
|
+
* because documents written before this field existed have none.
|
|
70
|
+
|
|
48
71
|
* Nothing here is a promise that a team has a shirt.
|
|
49
72
|
*/
|
|
50
|
-
export type PoolTeamKits =
|
|
73
|
+
export type PoolTeamKits = PoolTeamKit[];
|
|
74
|
+
|
|
75
|
+
export type PoolTeamKit = {
|
|
76
|
+
teamId: UUID;
|
|
77
|
+
/** Immutable: the address changes when the picture does, so it can be cached for a year. */
|
|
78
|
+
url: string;
|
|
79
|
+
};
|
|
51
80
|
|
|
52
81
|
export type PoolPayoutStructure = { [position: string]: number };
|
|
53
82
|
|