@sportsbroker/firebase-structure 3.7.0 → 3.9.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/README.md +6 -0
- package/models/details/matches/events.d.ts +2 -2
- package/models/details/matches/h2h.d.ts +14 -0
- package/models/details/users/ownedShares.d.ts +2 -2
- package/models/global.d.ts +8 -1
- package/models/snapshots/matchOverviews.d.ts +20 -1
- package/models/snapshots/tableSummary.d.ts +1 -7
- package/package.json +8 -2
- package/tsconfig.json +10 -0
- package/.editorconfig +0 -16
- package/.idea/firebase-structure.iml +0 -8
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -69
- package/database-rules.json +0 -61
- package/screen-queries +0 -28
package/README.md
CHANGED
|
@@ -198,3 +198,9 @@ Section for objects which are helpers (described in [Queries helpers](#queries-h
|
|
|
198
198
|
They should be only used to create ordered queries for retrieving id's of objects which are then used to get proper data which is about to be displayed.
|
|
199
199
|
|
|
200
200
|
In queries section besides logical types sections level there is introduced also some level of sentence building words (such as `queries/matches/of/teams` for matches played by some teams which need to be constrained by `teamId` and sorted by `startDate`) in order to increase query purpose readability.
|
|
201
|
+
|
|
202
|
+
### testing locally
|
|
203
|
+
|
|
204
|
+
1. Run `tsc && npm pack`
|
|
205
|
+
2. Copy absolute path to `sportsbroker-firebase-structure-<version>.tgz`
|
|
206
|
+
3. Run `npm install <absolute-path>` on another project
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TeamID,
|
|
1
|
+
import { TeamID, TeamSide } from "../../global";
|
|
2
2
|
|
|
3
3
|
type EventType = "YELLOW_CARD" | "RED_CARD" | "GOAL" | "SUBSTITUTION";
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ interface EventTime {
|
|
|
13
13
|
interface BaseEvent {
|
|
14
14
|
type: EventType;
|
|
15
15
|
time: EventTime;
|
|
16
|
-
teamType:
|
|
16
|
+
teamType: TeamSide;
|
|
17
17
|
teamId: TeamID;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface HeadToHeadStats {
|
|
2
|
+
wins: number;
|
|
3
|
+
homeWins: number;
|
|
4
|
+
awayWins: number;
|
|
5
|
+
draws: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// h2hId - "<teamAId>_<teamBId>"
|
|
9
|
+
|
|
10
|
+
export interface HeadToHead {
|
|
11
|
+
[sportId: string]: {
|
|
12
|
+
[h2hId: string]: HeadToHeadStats,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ISODate, MatchID, SportID,
|
|
1
|
+
import {ISODate, MatchID, SportID, TeamSide} from "../../global";
|
|
2
2
|
|
|
3
3
|
export interface UserOwnedShares {
|
|
4
4
|
sportId: SportID;
|
|
@@ -26,7 +26,7 @@ export interface OwnedSharesSplits {
|
|
|
26
26
|
|
|
27
27
|
export interface OwnedSharesSplit {
|
|
28
28
|
matchId: MatchID;
|
|
29
|
-
teamType:
|
|
29
|
+
teamType: TeamSide;
|
|
30
30
|
date: ISODate;
|
|
31
31
|
sharesAmountAfterSplit: number;
|
|
32
32
|
sharesAmountDiff: number;
|
package/models/global.d.ts
CHANGED
|
@@ -31,7 +31,9 @@ export interface Image {
|
|
|
31
31
|
default: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export type
|
|
34
|
+
export type MatchResult = "WON" | "DRAW" | "LOST";
|
|
35
|
+
|
|
36
|
+
export type TeamSide = "home" | "away";
|
|
35
37
|
|
|
36
38
|
export type MatchPeriod =
|
|
37
39
|
| "FIRST_HALF"
|
|
@@ -40,6 +42,11 @@ export type MatchPeriod =
|
|
|
40
42
|
| "SECOND_OVERTIME_HALF"
|
|
41
43
|
| "SHOOTOUT";
|
|
42
44
|
|
|
45
|
+
export interface MatchSide<T> {
|
|
46
|
+
home: T;
|
|
47
|
+
away: T;
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
/**
|
|
44
51
|
* PENDING means that match hasn't started yet
|
|
45
52
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Image, ISODate, MatchPeriod, MatchStatus, TeamID} from "../global";
|
|
1
|
+
import {Image, ISODate, MatchPeriod, MatchResult, MatchSide, MatchStatus, TeamID, TeamSide} from "../global";
|
|
2
2
|
|
|
3
3
|
export interface Team {
|
|
4
4
|
id: TeamID;
|
|
@@ -7,6 +7,24 @@ export interface Team {
|
|
|
7
7
|
logo?: Image;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface Opponent {
|
|
11
|
+
name: string;
|
|
12
|
+
score: number;
|
|
13
|
+
logo: string;
|
|
14
|
+
abbreviation: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface PreviousMatch {
|
|
18
|
+
playedAs: TeamSide;
|
|
19
|
+
result: MatchResult;
|
|
20
|
+
score: number;
|
|
21
|
+
opponent: Opponent;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type PreviousMatchesMap = {[matchId: string]: PreviousMatch};
|
|
25
|
+
|
|
26
|
+
export type PreviousMatches = MatchSide<PreviousMatchesMap>;
|
|
27
|
+
|
|
10
28
|
export interface Share {
|
|
11
29
|
price: number;
|
|
12
30
|
openingPrice: number;
|
|
@@ -41,6 +59,7 @@ export interface MatchOverviewSnapshot {
|
|
|
41
59
|
roundNb: number;
|
|
42
60
|
eventStatus: EventStatus;
|
|
43
61
|
season: string;
|
|
62
|
+
previousMatches: PreviousMatches;
|
|
44
63
|
}
|
|
45
64
|
|
|
46
65
|
export interface MatchOverviews {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Image, MatchResult} from "../global";
|
|
2
2
|
import { Team } from "./matchOverviews";
|
|
3
3
|
import { TeamRanking } from "../details/tables/ranking";
|
|
4
4
|
|
|
@@ -9,12 +9,6 @@ export interface MatchOutcome {
|
|
|
9
9
|
startDate: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export enum MatchResult {
|
|
13
|
-
WON = "WON",
|
|
14
|
-
DRAW = "DRAW",
|
|
15
|
-
LOST = "LOST"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
12
|
export interface TeamTable {
|
|
19
13
|
name: string;
|
|
20
14
|
abbreviation: string;
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sportsbroker/firebase-structure",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Firebase structure typings",
|
|
5
5
|
"main": "index.d.ts",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/SportsBroker-HQ/firebase-structure"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prepublish": "tsc"
|
|
12
|
+
},
|
|
10
13
|
"author": "SportsBroker",
|
|
11
14
|
"license": "ISC",
|
|
12
15
|
"bugs": {
|
|
13
16
|
"url": "https://github.com/BonFireITLTD/firebase-structure/issues"
|
|
14
17
|
},
|
|
15
|
-
"homepage": "https://github.com/BonFireITLTD/firebase-structure#readme"
|
|
18
|
+
"homepage": "https://github.com/BonFireITLTD/firebase-structure#readme",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^3.7.5"
|
|
21
|
+
}
|
|
16
22
|
}
|
package/tsconfig.json
ADDED
package/.editorconfig
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Editor configuration, see https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.md]
|
|
12
|
-
max_line_length = off
|
|
13
|
-
trim_trailing_whitespace = false
|
|
14
|
-
|
|
15
|
-
[{Makefile,**.mk}]
|
|
16
|
-
indent_style = tab
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$" />
|
|
5
|
-
<orderEntry type="inheritedJdk" />
|
|
6
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
-
</component>
|
|
8
|
-
</module>
|
package/.idea/misc.xml
DELETED
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/firebase-structure.iml" filepath="$PROJECT_DIR$/.idea/firebase-structure.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/vcs.xml
DELETED
package/.idea/workspace.xml
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="c25c12c1-92cf-4b48-9665-ce4aa95c492f" name="Default Changelist" comment="" />
|
|
5
|
-
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
6
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
7
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
8
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
9
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
10
|
-
</component>
|
|
11
|
-
<component name="ComposerSettings">
|
|
12
|
-
<execution>
|
|
13
|
-
<executable />
|
|
14
|
-
</execution>
|
|
15
|
-
</component>
|
|
16
|
-
<component name="Git.Settings">
|
|
17
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
18
|
-
</component>
|
|
19
|
-
<component name="ProjectId" id="1WnqFegWJM8ozCn5pZGzULxnYew" />
|
|
20
|
-
<component name="PropertiesComponent">
|
|
21
|
-
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
22
|
-
<property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
|
|
23
|
-
</component>
|
|
24
|
-
<component name="RunDashboard">
|
|
25
|
-
<option name="ruleStates">
|
|
26
|
-
<list>
|
|
27
|
-
<RuleState>
|
|
28
|
-
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
|
29
|
-
</RuleState>
|
|
30
|
-
<RuleState>
|
|
31
|
-
<option name="name" value="StatusDashboardGroupingRule" />
|
|
32
|
-
</RuleState>
|
|
33
|
-
</list>
|
|
34
|
-
</option>
|
|
35
|
-
</component>
|
|
36
|
-
<component name="SvnConfiguration">
|
|
37
|
-
<configuration />
|
|
38
|
-
</component>
|
|
39
|
-
<component name="TaskManager">
|
|
40
|
-
<task active="true" id="Default" summary="Default task">
|
|
41
|
-
<changelist id="c25c12c1-92cf-4b48-9665-ce4aa95c492f" name="Default Changelist" comment="" />
|
|
42
|
-
<created>1579795603272</created>
|
|
43
|
-
<option name="number" value="Default" />
|
|
44
|
-
<option name="presentableId" value="Default" />
|
|
45
|
-
<updated>1579795603272</updated>
|
|
46
|
-
<workItem from="1579795605208" duration="2230000" />
|
|
47
|
-
<workItem from="1579855537949" duration="3926000" />
|
|
48
|
-
<workItem from="1580116455639" duration="1416000" />
|
|
49
|
-
<workItem from="1580203699571" duration="4292000" />
|
|
50
|
-
</task>
|
|
51
|
-
<servers />
|
|
52
|
-
</component>
|
|
53
|
-
<component name="TypeScriptGeneratedFilesManager">
|
|
54
|
-
<option name="version" value="1" />
|
|
55
|
-
</component>
|
|
56
|
-
<component name="Vcs.Log.Tabs.Properties">
|
|
57
|
-
<option name="TAB_STATES">
|
|
58
|
-
<map>
|
|
59
|
-
<entry key="MAIN">
|
|
60
|
-
<value>
|
|
61
|
-
<State>
|
|
62
|
-
<option name="COLUMN_ORDER" />
|
|
63
|
-
</State>
|
|
64
|
-
</value>
|
|
65
|
-
</entry>
|
|
66
|
-
</map>
|
|
67
|
-
</option>
|
|
68
|
-
</component>
|
|
69
|
-
</project>
|
package/database-rules.json
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"rules": {
|
|
3
|
-
".read": false,
|
|
4
|
-
".write": false,
|
|
5
|
-
"queries": {
|
|
6
|
-
".read": true
|
|
7
|
-
},
|
|
8
|
-
"snapshots": {
|
|
9
|
-
".read": true
|
|
10
|
-
},
|
|
11
|
-
"details": {
|
|
12
|
-
"matches": {
|
|
13
|
-
".read": true
|
|
14
|
-
},
|
|
15
|
-
"ranking": {
|
|
16
|
-
".read": true
|
|
17
|
-
},
|
|
18
|
-
"seasons": {
|
|
19
|
-
".read": true
|
|
20
|
-
},
|
|
21
|
-
"tables": {
|
|
22
|
-
".read": true
|
|
23
|
-
},
|
|
24
|
-
"teams": {
|
|
25
|
-
".read": true
|
|
26
|
-
},
|
|
27
|
-
"users": {
|
|
28
|
-
"notifications": {
|
|
29
|
-
"$uid": {
|
|
30
|
-
".read": "$uid === auth.uid"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"orders": {
|
|
34
|
-
"$uid": {
|
|
35
|
-
".read": "$uid === auth.uid"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"overviews": {
|
|
39
|
-
"$uid": {
|
|
40
|
-
".read": "$uid === auth.uid"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"ownedShares": {
|
|
44
|
-
"$uid": {
|
|
45
|
-
".read": "$uid === auth.uid"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"wallet": {
|
|
49
|
-
"$uid": {
|
|
50
|
-
".read": "$uid === auth.uid"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"messages": {
|
|
54
|
-
"$uid": {
|
|
55
|
-
".read": "$uid === auth.uid"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
package/screen-queries
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
MATCHES https://zpl.io/2poYgA8
|
|
2
|
-
|
|
3
|
-
List query:
|
|
4
|
-
queries/matches/in/seasons/_seasonId_
|
|
5
|
-
.orderByChild("startDate")
|
|
6
|
-
|
|
7
|
-
Paging for example with separate query for each page with startAt() and endAt() constraints - 1 week should work fine
|
|
8
|
-
As listener it's better to use ValueListener to avoid effect of adding previous items from top to bottom above first item of previous list - it shouldn't happen too often that query list will change
|
|
9
|
-
|
|
10
|
-
For each children in value snapshot need to take key which is _matchId_ and query:
|
|
11
|
-
snapshots/matchOverviews/_sportId_/_matchId_
|
|
12
|
-
|
|
13
|
-
Then need to take from teams/home/id (same from away) and subscribe both to:
|
|
14
|
-
|
|
15
|
-
details/teams/shares/_sportId_/_teamId_
|
|
16
|
-
|
|
17
|
-
And use it to set Buy/Sell buttons - needs to be out of snapshot as it's updated too often
|
|
18
|
-
|
|
19
|
-
MATCH_EVENTS
|
|
20
|
-
|
|
21
|
-
In match details topbar and "ViewAll" dialog - https://zpl.io/a3zwQBd
|
|
22
|
-
For home team:
|
|
23
|
-
|
|
24
|
-
details/matches/events/_sportId_/_matchId_/home
|
|
25
|
-
.orderByChild("time/minutes")
|
|
26
|
-
|
|
27
|
-
For overview limitToLast(1)
|
|
28
|
-
For dialog can be subscribed without limits as items are so small that they don't need paging
|