@sportsbroker/firebase-structure 2.4.2 → 2.5.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.
@@ -3,6 +3,7 @@ import { Teams } from "./teams/_index";
3
3
  import { Matches } from "./matches/_index";
4
4
  import { Tables } from "./tables/_index";
5
5
  import { Ranking } from "./ranking/_index";
6
+ import { Seasons } from "./seasons/_index";
6
7
 
7
8
  export interface Details {
8
9
  users: Users;
@@ -10,4 +11,5 @@ export interface Details {
10
11
  matches: Matches;
11
12
  tables: Tables;
12
13
  ranking: Ranking;
14
+ seasons: Seasons;
13
15
  }
@@ -0,0 +1,7 @@
1
+ import { Overviews } from "./overviews";
2
+ import { TeamsInSeasons } from "./teams";
3
+
4
+ export interface Seasons {
5
+ overviews: Overviews;
6
+ teams: TeamsInSeasons;
7
+ }
@@ -0,0 +1,20 @@
1
+ import { Date, Image, SeasonID } from "../../global";
2
+
3
+ export interface SeasonOverview {
4
+ endDate: Date;
5
+ id: SeasonID; // "EPL2018" or similar used as reference
6
+ name: string; // examples: "English Premier League", "Major League Soccer", "Germany Bundesliga"
7
+ startDate: Date;
8
+ isActive: boolean; // indicate if season is currently active, or archival one
9
+ logo?: Image;
10
+ }
11
+
12
+ /**
13
+ * sportId: SportID
14
+ * seasonId: SeasonID
15
+ */
16
+ export interface Overviews {
17
+ [sportId: string]: {
18
+ [seasonId: string]: SeasonOverview;
19
+ };
20
+ }
@@ -0,0 +1,14 @@
1
+ import { TeamID, SportID, SeasonID } from "../../global";
2
+
3
+ /**
4
+ * sportId: SportID
5
+ * seasonId: SeasonID
6
+ * teamId: TeamID
7
+ */
8
+ export interface TeamsInSeasons {
9
+ [sportId: string]: {
10
+ [seasonId: string]: {
11
+ [teamId: string]: boolean;
12
+ };
13
+ };
14
+ }
@@ -1,14 +1,11 @@
1
- import { Image, TeamID } from "../../global";
1
+ import {Image, TeamID, WithSeasons} from "../../global";
2
2
 
3
- export interface TeamOverview {
3
+ export interface TeamOverview extends WithSeasons {
4
4
  name: string;
5
5
  abbreviation: string;
6
6
  id: TeamID;
7
7
  logo?: Image;
8
8
  isCurrentlyPlaying: boolean;
9
- seasons: {
10
- [seasonId: string]: boolean; // Firebase will treat it as an array. Available: "BUND2018" | "EPL2018"
11
- };
12
9
  }
13
10
 
14
11
  /**
@@ -42,3 +42,9 @@ export type MatchPeriod =
42
42
  * PENDING means that match hasn't started yet
43
43
  */
44
44
  export type MatchStatus = "PENDING" | "STARTED" | "FINISHED";
45
+
46
+ export interface WithSeasons {
47
+ seasons: {
48
+ [seasonsName: string]: boolean; // Firebase will treat it as an array. Available: "BUND2018" | "EPL2018"
49
+ };
50
+ }
@@ -1,9 +1,11 @@
1
1
  import { MatchesQueries } from "./matches";
2
2
  import { SharesQueries } from "./shares";
3
3
  import { OrdersQueries } from "./orders";
4
+ import { ActiveSeasonsQueries } from "./seasons";
4
5
 
5
6
  export interface Queries {
6
7
  matches: MatchesQueries;
7
8
  shares: SharesQueries;
8
9
  orders: OrdersQueries;
10
+ seasons: ActiveSeasonsQueries;
9
11
  }
@@ -5,6 +5,7 @@ interface MatchQueryData {
5
5
  realStartDate: Date; // Real start time, f.e match was delayed
6
6
  roundNb: number;
7
7
  matchStatus: MatchStatus;
8
+ season: string;
8
9
  }
9
10
 
10
11
  interface Matches {
@@ -0,0 +1,15 @@
1
+ import { SportID, SeasonID } from "../global";
2
+
3
+ /**
4
+ * sportId: SportID
5
+ * seasonId: SeasonID
6
+ */
7
+ export interface ActiveSeasons {
8
+ active: {
9
+ [sportId: string]: {
10
+ [seasonId: string]: true;
11
+ };
12
+ }
13
+ }
14
+
15
+ export { ActiveSeasons as ActiveSeasonsQueries };
@@ -1,3 +1,11 @@
1
+ import { WithSeasons } from "../global";
2
+
3
+ export interface ShareOfTeam extends WithSeasons {
4
+ id: string;
5
+ name: string;
6
+ abbreviation: string;
7
+ }
8
+
1
9
  interface Shares {
2
10
  of: {
3
11
  teams: {
@@ -5,10 +13,7 @@ interface Shares {
5
13
  /**
6
14
  * Sort by name / abbreviation, take team ID to access share
7
15
  */
8
- [teamID: string]: {
9
- name: string;
10
- abbreviation: string;
11
- };
16
+ [teamID: string]: ShareOfTeam;
12
17
  };
13
18
  };
14
19
  };
@@ -1,19 +1,19 @@
1
1
  import { Image, MatchPeriod, MatchStatus, TeamID } from "../global";
2
2
 
3
- interface Team {
3
+ export interface Team {
4
4
  id: TeamID;
5
5
  name: string;
6
6
  abbreviation: string;
7
7
  logo?: Image;
8
8
  }
9
9
 
10
- interface Share {
10
+ export interface Share {
11
11
  price: number;
12
12
  openingPrice: number;
13
13
  priceChangePercentage: number;
14
14
  }
15
15
 
16
- interface EventStatus {
16
+ export interface EventStatus {
17
17
  matchStatus: MatchStatus;
18
18
  period: MatchPeriod;
19
19
  isActive: boolean;
@@ -23,24 +23,27 @@ interface EventStatus {
23
23
  };
24
24
  }
25
25
 
26
+ export interface MatchOverview {
27
+ teams: {
28
+ home: Team;
29
+ away: Team;
30
+ };
31
+ score: {
32
+ home: number;
33
+ away: number;
34
+ };
35
+ share?: {
36
+ home: Share;
37
+ away: Share;
38
+ };
39
+ startDate: Date;
40
+ roundNb: number;
41
+ eventStatus: EventStatus;
42
+ season: string;
43
+ }
44
+
26
45
  export interface MatchOverviews {
27
46
  [sportID: string]: {
28
- [matchID: string]: {
29
- teams: {
30
- home: Team;
31
- away: Team;
32
- };
33
- score: {
34
- home: number;
35
- away: number;
36
- };
37
- share?: {
38
- home: Share;
39
- away: Share;
40
- };
41
- startDate: Date;
42
- roundNb: number;
43
- eventStatus: EventStatus;
44
- };
47
+ [matchID: string]: MatchOverview;
45
48
  };
46
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {