@sportsbroker/firebase-structure 2.3.0 → 2.4.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.
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { Image, TeamID } from "../../global";
|
|
2
2
|
|
|
3
|
+
export interface TeamOverview {
|
|
4
|
+
name: string;
|
|
5
|
+
abbreviation: string;
|
|
6
|
+
id: TeamID;
|
|
7
|
+
logo?: Image;
|
|
8
|
+
isCurrentlyPlaying: Boolean;
|
|
9
|
+
seasons: {
|
|
10
|
+
[seasonId: string]: boolean; // Firebase will treat it as an array. Available: "BUND2018" | "EPL2018"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
3
14
|
/**
|
|
4
15
|
* sportId: SportID
|
|
5
16
|
* teamId: TeamID
|
|
6
17
|
*/
|
|
7
18
|
export interface Overviews {
|
|
8
19
|
[sportId: string]: {
|
|
9
|
-
[teamId: string]:
|
|
10
|
-
name: string;
|
|
11
|
-
abbreviation: string;
|
|
12
|
-
id: TeamID;
|
|
13
|
-
logo?: Image;
|
|
14
|
-
isCurrentlyPlaying: Boolean;
|
|
15
|
-
seasons: {
|
|
16
|
-
[seasonId: string]: boolean; // Firebase will treat it as an array. Available: "BUND2018" | "EPL2018"
|
|
17
|
-
};
|
|
18
|
-
};
|
|
20
|
+
[teamId: string]: TeamOverview;
|
|
19
21
|
};
|
|
20
22
|
}
|
|
@@ -7,16 +7,18 @@ interface MarketIndicators {
|
|
|
7
7
|
capacity: number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface TeamShare {
|
|
11
|
+
price: number;
|
|
12
|
+
openingPrice: number;
|
|
13
|
+
priceChangePercentage: number;
|
|
14
|
+
buyPrice: number;
|
|
15
|
+
sellPrice: number;
|
|
16
|
+
id: TeamID;
|
|
17
|
+
market: MarketIndicators;
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
export interface Shares {
|
|
11
21
|
[sportId: string]: {
|
|
12
|
-
[teamId: string]:
|
|
13
|
-
price: number;
|
|
14
|
-
openingPrice: number;
|
|
15
|
-
priceChangePercentage: number;
|
|
16
|
-
buyPrice: number;
|
|
17
|
-
sellPrice: number;
|
|
18
|
-
id: TeamID;
|
|
19
|
-
market: MarketIndicators;
|
|
20
|
-
};
|
|
22
|
+
[teamId: string]: TeamShare;
|
|
21
23
|
};
|
|
22
24
|
}
|
|
@@ -4,6 +4,7 @@ import { Wallet } from "./wallet";
|
|
|
4
4
|
import { Watchlist } from "./watchlist";
|
|
5
5
|
import { Notifications } from "./notifications";
|
|
6
6
|
import { OwnedShares } from "./ownedShares";
|
|
7
|
+
import { Transactions } from './transactions';
|
|
7
8
|
|
|
8
9
|
export interface Users {
|
|
9
10
|
orders: Orders;
|
|
@@ -12,4 +13,5 @@ export interface Users {
|
|
|
12
13
|
watchlist: Watchlist;
|
|
13
14
|
notifications: Notifications;
|
|
14
15
|
ownedShares: OwnedShares;
|
|
16
|
+
transactions: Transactions;
|
|
15
17
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Date, SportID, UserID } from "../../global";
|
|
2
|
+
|
|
3
|
+
type TransactionID = string;
|
|
4
|
+
|
|
5
|
+
export enum TransactionType {
|
|
6
|
+
WITHDRAW = "WITHDRAW",
|
|
7
|
+
DEPOSIT = "DEPOSIT",
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// currently only one supported, but will be more
|
|
11
|
+
export enum TransactionPaymentMethod {
|
|
12
|
+
SKRILL = "SKRILL"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* unified statuses for all transactions
|
|
17
|
+
* (internally backend uses different statuses, per each provider)
|
|
18
|
+
*/
|
|
19
|
+
export enum TransactionStatus {
|
|
20
|
+
PREPARED = "PREPARED",
|
|
21
|
+
PENDING = "PENDING",
|
|
22
|
+
SUCCEED = "SUCCEED",
|
|
23
|
+
FAILED = "FAILED",
|
|
24
|
+
CANCELLED = "CANCELLED",
|
|
25
|
+
IN_REVIEW = "IN_REVIEW",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* userID: UserID
|
|
30
|
+
* transactionID: TransactionID
|
|
31
|
+
*/
|
|
32
|
+
export interface Transactions {
|
|
33
|
+
[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
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|