@sportsbroker/firebase-structure 9.1.0 → 9.3.1

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.
@@ -28,6 +28,43 @@ export type Pool = {
28
28
  payoutStructure: PoolPayoutStructure;
29
29
  prizeDistributionStrategy: PrizeDistributionStrategyEnum;
30
30
  track?: PoolTrack;
31
+ teamKits?: PoolTeamKits;
32
+ };
33
+
34
+ /**
35
+ * The shirts to draw for the teams taking part in this pool.
36
+ *
37
+ * One entry per team that HAS a shirt, never an entry per team. A pool is not one match - a
38
+ * prediction or score-predictor pool runs over several fixtures and therefore over several teams -
39
+ * so this covers all of them at once. The ids are the same ones the `Fixtures` documents named
40
+ * under `matchIds`, so a client joins what it already read.
41
+ *
42
+ * It lives on the POOL and not on the fixture because a shirt is one operator's choice: a fixture
43
+ * document is shared by every operator running that match, and could not carry a per-operator
44
+ * answer. The pool is the only document that knows whose it is.
45
+ *
46
+ * A LIST and not a map, which is a storage fact rather than a taste. Pool documents are written
47
+ * with a merge, and a merge DEEP-merges a nested map: a shirt that was removed, repointed at
48
+ * another team, or keyed to a team that has since left a hand-entered fixture would stay in that
49
+ * map for ever, because a write that stops naming a key does not remove it. A list is replaced
50
+ * whole, so what was written last is what a player sees. A client that wants lookup by id builds
51
+ * its own map once.
52
+ *
53
+ * Optional to READ, always written. A team with no shirt has no entry, and a pool whose teams have
54
+ * none carries an EMPTY list rather than no field: a write that simply stopped sending the field
55
+ * would leave the previous list in place, for the same merge reason as above. So presence means
56
+ * nothing and length means everything - a client checks whether the list has an entry for the team
57
+ * it is drawing, and draws what it drew before when it has not. It stays optional on the type
58
+ * because documents written before this field existed have none.
59
+
60
+ * Nothing here is a promise that a team has a shirt.
61
+ */
62
+ export type PoolTeamKits = PoolTeamKit[];
63
+
64
+ export type PoolTeamKit = {
65
+ teamId: UUID;
66
+ /** Immutable: the address changes when the picture does, so it can be cached for a year. */
67
+ url: string;
31
68
  };
32
69
 
33
70
  export type PoolPayoutStructure = { [position: string]: number };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "9.1.0",
3
+ "version": "9.3.1",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {