@sportsbroker/firebase-structure 2.5.0 → 3.0.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,21 +1,23 @@
1
1
  import { MatchPeriod } from "../../global";
2
2
 
3
+ export interface Commentary {
4
+ period: MatchPeriod;
5
+ headline: string;
6
+ text: string;
7
+ time: {
8
+ minutes: number;
9
+ seconds: number;
10
+ additionalMinutes: number;
11
+ };
12
+ }
13
+
3
14
  /**
4
15
  * Not implemented yet
5
16
  */
6
17
  export interface Commentaries {
7
18
  [sportID: string]: {
8
19
  [matchID: string]: {
9
- [commentaryID: string]: {
10
- period: MatchPeriod;
11
- headline: string;
12
- text: string;
13
- time: {
14
- minutes: number;
15
- seconds: number;
16
- additionalMinutes: number;
17
- };
18
- };
20
+ [commentaryID: string]: Commentary;
19
21
  };
20
22
  };
21
23
  }
@@ -1,4 +1,4 @@
1
- import { Date, MatchPeriod, MatchStatus } from "../../global";
1
+ import { ISODate, MatchPeriod, MatchStatus } from "../../global";
2
2
 
3
3
  export interface MatchTime {
4
4
  minutes: number;
@@ -12,14 +12,16 @@ export interface EventStatus {
12
12
  matchTime?: MatchTime;
13
13
  }
14
14
 
15
+ export interface MatchOverview {
16
+ startDate: ISODate;
17
+ roundNb: number;
18
+ originalRoundNb: number;
19
+ isTba: boolean;
20
+ eventStatus: EventStatus;
21
+ }
22
+
15
23
  export interface Overviews {
16
24
  [sportId: string]: {
17
- [matchId: string]: {
18
- startDate: Date;
19
- roundNb: number;
20
- originalRoundNb: number;
21
- isTba: boolean;
22
- eventStatus: EventStatus;
23
- };
25
+ [matchId: string]: MatchOverview;
24
26
  };
25
27
  }
@@ -3,18 +3,22 @@ export interface Score {
3
3
  away: number;
4
4
  }
5
5
 
6
+ export interface MatchPeriods{
7
+ firstHalf: Score;
8
+ secondHalf?: Score;
9
+ firstOvertime?: Score;
10
+ secondOvertime?: Score;
11
+ }
12
+
13
+ export interface MatchScore {
14
+ home: number;
15
+ away: number;
16
+ periods: MatchPeriods;
17
+ shootoutPenalties?: Score;
18
+ }
19
+
6
20
  export interface Scores {
7
21
  [sportID: string]: {
8
- [matchID: string]: {
9
- home: number;
10
- away: number;
11
- periods: {
12
- firstHalf: Score;
13
- secondHalf?: Score;
14
- firstOvertime?: Score;
15
- secondOvertime?: Score;
16
- };
17
- shootoutPenalties?: Score;
18
- };
22
+ [matchID: string]: MatchScore;
19
23
  };
20
24
  }
@@ -1,14 +1,16 @@
1
- export interface MatchShares {
1
+ export interface MatchTeamShares {
2
2
  price: number;
3
3
  openingPrice: number;
4
4
  priceChangePercentage: number;
5
5
  }
6
6
 
7
+ export interface MatchShares {
8
+ home: MatchTeamShares;
9
+ away: MatchTeamShares;
10
+ }
11
+
7
12
  export interface Shares {
8
13
  [sportID: string]: {
9
- [matchID: string]: {
10
- home: MatchShares;
11
- away: MatchShares;
12
- };
14
+ [matchID: string]: MatchShares;
13
15
  };
14
16
  }
@@ -1,14 +1,16 @@
1
1
  export type VenueID = string;
2
2
 
3
+ export interface VenueOverview {
4
+ id: VenueID;
5
+ name: string;
6
+ city: string;
7
+ }
8
+
3
9
  /**
4
10
  * Not implemented yet
5
11
  */
6
12
  export interface VenueOverviews {
7
13
  [sportID: string]: {
8
- [matchID: string]: {
9
- id: VenueID;
10
- name: string;
11
- city: string;
12
- };
14
+ [matchID: string]: VenueOverview;
13
15
  };
14
16
  }
@@ -1,10 +1,10 @@
1
- import { Date, Image, SeasonID } from "../../global";
1
+ import { ISODate, Image, SeasonID } from "../../global";
2
2
 
3
3
  export interface SeasonOverview {
4
- endDate: Date;
4
+ endDate: ISODate;
5
5
  id: SeasonID; // "EPL2018" or similar used as reference
6
6
  name: string; // examples: "English Premier League", "Major League Soccer", "Germany Bundesliga"
7
- startDate: Date;
7
+ startDate: ISODate;
8
8
  isActive: boolean; // indicate if season is currently active, or archival one
9
9
  logo?: Image;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { UserID, Language } from "../../global";
1
+ import {UserID, Language, ISODate} from "../../global";
2
2
 
3
3
  export type NotificationID = string;
4
4
 
@@ -8,6 +8,16 @@ export type NotificationType =
8
8
  | "TEAM_ELIMINATED"
9
9
  | "KICK_OFF";
10
10
 
11
+ export interface Notification {
12
+ type: NotificationType;
13
+ title: string;
14
+ description?: string;
15
+ shown: boolean;
16
+ createdAt: ISODate;
17
+ updatedAt: ISODate;
18
+ id: NotificationID;
19
+ }
20
+
11
21
  /**
12
22
  * notificationId: NotificationID
13
23
  * language: Language
@@ -18,15 +28,7 @@ export interface Notifications {
18
28
  unreadCount: number;
19
29
  [language: string]: {
20
30
  entries: {
21
- [notificationId: string]: {
22
- type: NotificationType;
23
- title: string;
24
- description?: string;
25
- shown: boolean;
26
- createdAt: Date;
27
- updatedAt: Date;
28
- id: NotificationID;
29
- };
31
+ [notificationId: string]: Notification;
30
32
  };
31
33
  };
32
34
  };
@@ -1,4 +1,4 @@
1
- import { SportID, TeamID } from "../../global";
1
+ import {ISODate, SportID, TeamID} from "../../global";
2
2
 
3
3
  export type OrderActionType = "BUY" | "SELL";
4
4
 
@@ -8,29 +8,31 @@ export type OrderStatus = "ACTIVE" | "COMPLETED" | "ABORTED" | "CANCELLED";
8
8
 
9
9
  type OrderID = string;
10
10
 
11
+ export interface Order {
12
+ action: OrderActionType;
13
+ allOrNothing: boolean;
14
+ amount: number;
15
+ createdAt: ISODate;
16
+ limit?: number;
17
+ processedAmount: number;
18
+ processedMoney: number;
19
+ processedFee: number;
20
+ processedTotalMoney: number; // processedMoney + processedFee
21
+ sportId: SportID;
22
+ teamId: TeamID;
23
+ transactionFee: number;
24
+ type: OrderTransactionType;
25
+ updatedAt: ISODate;
26
+ status: OrderStatus;
27
+ id: OrderID;
28
+ }
29
+
11
30
  /**
12
31
  * userID: UserID
13
32
  * orderID: OrderID
14
33
  */
15
34
  export interface Orders {
16
35
  [userID: string]: {
17
- [orderID: string]: {
18
- action: OrderActionType;
19
- allOrNothing: boolean;
20
- amount: number;
21
- createdAt: Date;
22
- limit?: number;
23
- processedAmount: number;
24
- processedMoney: number;
25
- processedFee: number;
26
- processedTotalMoney: number; // processedMoney + processedFee
27
- sportId: SportID;
28
- teamId: TeamID;
29
- transactionFee: number;
30
- type: OrderTransactionType;
31
- updatedAt: Date;
32
- status: OrderStatus;
33
- id: OrderID;
34
- };
36
+ [orderID: string]: Order;
35
37
  };
36
38
  }
@@ -1,19 +1,21 @@
1
1
  import { SportID } from "../../global";
2
2
 
3
+ export interface UserOwnedShares {
4
+ sportId: SportID;
5
+ amount: number;
6
+ availableAmount: number;
7
+ value: number;
8
+ profit: number;
9
+ invested: number;
10
+ averagePricePerShare: number;
11
+ }
12
+
3
13
  /**
4
14
  * teamID: TeamID
5
15
  * userID: userID
6
16
  */
7
17
  export interface OwnedShares {
8
18
  [userID: string]: {
9
- [teamID: string]: {
10
- sportId: SportID;
11
- amount: number;
12
- availableAmount: number;
13
- value: number;
14
- profit: number;
15
- invested: number;
16
- averagePricePerShare: number;
17
- };
19
+ [teamID: string]: UserOwnedShares;
18
20
  };
19
21
  }
@@ -1,11 +1,13 @@
1
1
  import { UserID } from "../../global";
2
2
 
3
+ export interface UserRanking {
4
+ change: number;
5
+ equity: number;
6
+ position: number;
7
+ username: string;
8
+ }
9
+
3
10
  //Restricted access only to own data
4
11
  export interface Ranking {
5
- [userId: UserID]: {
6
- change: number;
7
- equity: number;
8
- position: number;
9
- username: string;
10
- };
12
+ [userId: UserID]: UserRanking;
11
13
  }
@@ -1,4 +1,4 @@
1
- import { Date, SportID, UserID } from "../../global";
1
+ import { ISODate, SportID, UserID } from "../../global";
2
2
 
3
3
  type TransactionID = string;
4
4
 
@@ -25,23 +25,25 @@ export enum TransactionStatus {
25
25
  IN_REVIEW = "IN_REVIEW",
26
26
  }
27
27
 
28
+ export interface Transation {
29
+ createdAt: ISODate;
30
+ updatedAt: ISODate;
31
+ executedAt?: ISODate;
32
+ id: TransactionID,
33
+ status: TransactionStatus;
34
+ type: TransactionType;
35
+ paymentMethod: TransactionPaymentMethod;
36
+ amount: number;
37
+ fee?: number;
38
+ balance?: number; // an initialize transaction balance would be null, and after finished will be filled
39
+ }
40
+
28
41
  /**
29
42
  * userID: UserID
30
43
  * transactionID: TransactionID
31
44
  */
32
45
  export interface Transactions {
33
46
  [userID: string]: {
34
- [transactionID: string]: {
35
- createdAt: Date;
36
- updatedAt: Date;
37
- executedAt?: Date;
38
- id: TransactionID,
39
- status: TransactionStatus;
40
- type: TransactionType;
41
- paymentMethod: TransactionPaymentMethod;
42
- amount: number;
43
- fee?: number;
44
- balance?: number; // an initialize transaction balance would be null, and after finished will be filled
45
- };
47
+ [transactionID: string]: Transation;
46
48
  };
47
49
  }
@@ -1,13 +1,15 @@
1
1
  import { UserID } from "../../global";
2
2
 
3
+ export interface UserWallet {
4
+ available: number;
5
+ invested: number;
6
+ profit: number;
7
+ equity: number;
8
+ }
9
+
3
10
  /**
4
11
  * userID: UserID
5
12
  */
6
13
  export interface Wallet {
7
- [userId: string]: {
8
- available: number;
9
- invested: number;
10
- profit: number;
11
- equity: number;
12
- };
14
+ [userId: string]: UserWallet;
13
15
  }
@@ -8,9 +8,9 @@ export type UserID = MongoID;
8
8
  export type TeamID = MongoID;
9
9
 
10
10
  /**
11
- * @type ISO Date
11
+ * @type ISO ISODate
12
12
  */
13
- export type Date = string;
13
+ export type ISODate = string;
14
14
 
15
15
  /**
16
16
  * Currently support only soccer
@@ -1,8 +1,8 @@
1
- import { Date, MatchStatus } from "../global";
1
+ import { ISODate, MatchStatus } from "../global";
2
2
 
3
3
  interface MatchQueryData {
4
- startDate: Date; // "Official", planned time of start
5
- realStartDate: Date; // Real start time, f.e match was delayed
4
+ startDate: ISODate; // "Official", planned time of start
5
+ realStartDate: ISODate; // Real start time, f.e match was delayed
6
6
  roundNb: number;
7
7
  matchStatus: MatchStatus;
8
8
  season: string;
@@ -1,11 +1,11 @@
1
- import { Date } from "../global";
1
+ import { ISODate } from "../global";
2
2
  import { OrderStatus } from "../details/users/orders";
3
3
 
4
4
  interface OrderQueryData {
5
5
  status: OrderStatus;
6
- createdAt: Date;
7
- updatedAt: Date;
8
- executedAt?: Date;
6
+ createdAt: ISODate;
7
+ updatedAt: ISODate;
8
+ executedAt?: ISODate;
9
9
  id: string;
10
10
  }
11
11
 
@@ -23,7 +23,7 @@ export interface EventStatus {
23
23
  };
24
24
  }
25
25
 
26
- export interface MatchOverview {
26
+ export interface MatchOverviewSnapshot {
27
27
  teams: {
28
28
  home: Team;
29
29
  away: Team;
@@ -44,6 +44,6 @@ export interface MatchOverview {
44
44
 
45
45
  export interface MatchOverviews {
46
46
  [sportID: string]: {
47
- [matchID: string]: MatchOverview;
47
+ [matchID: string]: MatchOverviewSnapshot;
48
48
  };
49
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "2.5.0",
3
+ "version": "3.0.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {