@winible/winible-typed 2.74.0 → 2.75.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/package.json
CHANGED
package/typed-model/index.ts
CHANGED
@@ -72,7 +72,7 @@ export { default as Market } from "./market";
|
|
72
72
|
export { default as Sportsbook } from "./sportsbook";
|
73
73
|
export { default as ComplianceRule } from "./compliance-rule";
|
74
74
|
export { default as League } from "./league";
|
75
|
-
export { default as
|
75
|
+
export { default as MarketOnLeague } from "./market-on-league";
|
76
76
|
export { default as AffiliateLink } from "./affiliate-link";
|
77
77
|
export { default as Odd } from "./odd";
|
78
78
|
export { default as Parlay } from "./parlay";
|
@@ -2,38 +2,36 @@ import {
|
|
2
2
|
Model,
|
3
3
|
InferAttributes,
|
4
4
|
InferCreationAttributes,
|
5
|
-
CreationOptional,
|
6
5
|
DataTypes,
|
7
|
-
fn,
|
8
6
|
} from "sequelize";
|
9
7
|
|
10
8
|
import sequelize from "./pb-sequelize";
|
11
9
|
import { StatusType } from "../src/types";
|
12
|
-
import
|
10
|
+
import League from "./league";
|
13
11
|
import Market from "./market";
|
14
12
|
|
15
13
|
// order of InferAttributes & InferCreationAttributes is important.
|
16
|
-
class
|
17
|
-
InferAttributes<
|
18
|
-
InferCreationAttributes<
|
14
|
+
class MarketOnLeague extends Model<
|
15
|
+
InferAttributes<MarketOnLeague>,
|
16
|
+
InferCreationAttributes<MarketOnLeague>
|
19
17
|
> {
|
20
18
|
// 'CreationOptional' is a special type that marks the field as optional
|
21
19
|
// when creating an instance of the model (such as using Model.create()).
|
22
|
-
declare
|
20
|
+
declare leagueId: string;
|
23
21
|
declare marketId: string;
|
24
22
|
declare status: StatusType;
|
25
23
|
}
|
26
24
|
|
27
|
-
|
25
|
+
MarketOnLeague.init(
|
28
26
|
{
|
29
|
-
|
27
|
+
leagueId: {
|
30
28
|
type: DataTypes.BIGINT,
|
31
29
|
allowNull: false,
|
32
30
|
references: {
|
33
|
-
model:
|
31
|
+
model: League,
|
34
32
|
key: "id",
|
35
33
|
},
|
36
|
-
field: "
|
34
|
+
field: "league_id",
|
37
35
|
},
|
38
36
|
marketId: {
|
39
37
|
type: DataTypes.BIGINT,
|
@@ -50,27 +48,27 @@ MarketOnBetSport.init(
|
|
50
48
|
},
|
51
49
|
},
|
52
50
|
{
|
53
|
-
tableName: "
|
54
|
-
comment: "Junction table that relates a
|
51
|
+
tableName: "markets_on_leagues",
|
52
|
+
comment: "Junction table that relates a league to a market",
|
55
53
|
timestamps: false,
|
56
54
|
sequelize,
|
57
55
|
}
|
58
56
|
);
|
59
57
|
|
60
|
-
|
61
|
-
through:
|
62
|
-
foreignKey: "
|
58
|
+
League.belongsToMany(Market, {
|
59
|
+
through: MarketOnLeague,
|
60
|
+
foreignKey: "leagueId",
|
63
61
|
sourceKey: "id",
|
64
62
|
onDelete: "NO ACTION",
|
65
63
|
constraints: false,
|
66
64
|
});
|
67
65
|
|
68
|
-
Market.belongsToMany(
|
69
|
-
through:
|
66
|
+
Market.belongsToMany(League, {
|
67
|
+
through: MarketOnLeague,
|
70
68
|
foreignKey: "marketId",
|
71
69
|
sourceKey: "id",
|
72
70
|
onDelete: "NO ACTION",
|
73
71
|
constraints: false,
|
74
72
|
});
|
75
73
|
|
76
|
-
export default
|
74
|
+
export default MarketOnLeague;
|