@winible/winible-typed 2.88.1 → 2.89.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
@@ -82,5 +82,6 @@ export { default as OddsOnParlays } from "./odds-on-parlays";
|
|
82
82
|
export { default as ParlaysOnBets } from "./parlays-on-bets";
|
83
83
|
export { default as DefaultCompliancePolicy } from "./default-compliance-policy";
|
84
84
|
export { default as Dispute } from "./dispute";
|
85
|
+
export { default as SportsbookOnMarket } from "./sportsbook-on-market";
|
85
86
|
|
86
87
|
export { default as pbSequelize } from "./pb-sequelize";
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import {
|
2
|
+
Model,
|
3
|
+
InferAttributes,
|
4
|
+
InferCreationAttributes,
|
5
|
+
DataTypes,
|
6
|
+
} from "sequelize";
|
7
|
+
|
8
|
+
import sequelize from "./pb-sequelize";
|
9
|
+
import { StatusType } from "../src/types";
|
10
|
+
import Sportsbook from "./sportsbook";
|
11
|
+
import Market from "./market";
|
12
|
+
|
13
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
14
|
+
class SportsbookOnMarket extends Model<
|
15
|
+
InferAttributes<SportsbookOnMarket>,
|
16
|
+
InferCreationAttributes<SportsbookOnMarket>
|
17
|
+
> {
|
18
|
+
// 'CreationOptional' is a special type that marks the field as optional
|
19
|
+
// when creating an instance of the model (such as using Model.create()).
|
20
|
+
declare sportsbookId: string;
|
21
|
+
declare marketId: string;
|
22
|
+
declare status: StatusType;
|
23
|
+
}
|
24
|
+
|
25
|
+
SportsbookOnMarket.init(
|
26
|
+
{
|
27
|
+
sportsbookId: {
|
28
|
+
type: DataTypes.BIGINT,
|
29
|
+
allowNull: false,
|
30
|
+
references: {
|
31
|
+
model: Sportsbook,
|
32
|
+
key: "id",
|
33
|
+
},
|
34
|
+
field: "sportsbook_id",
|
35
|
+
},
|
36
|
+
marketId: {
|
37
|
+
type: DataTypes.BIGINT,
|
38
|
+
allowNull: false,
|
39
|
+
references: {
|
40
|
+
model: Market,
|
41
|
+
key: "id",
|
42
|
+
},
|
43
|
+
field: "market_id",
|
44
|
+
},
|
45
|
+
status: {
|
46
|
+
type: DataTypes.ENUM(...Object.values(StatusType)),
|
47
|
+
allowNull: false,
|
48
|
+
defaultValue: StatusType.ACTIVE,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
{
|
52
|
+
tableName: "sportsbooks_on_markets",
|
53
|
+
comment: "Junction table that relates a sportsbook to a market",
|
54
|
+
timestamps: false,
|
55
|
+
sequelize,
|
56
|
+
}
|
57
|
+
);
|
58
|
+
|
59
|
+
Sportsbook.belongsToMany(Market, {
|
60
|
+
through: SportsbookOnMarket,
|
61
|
+
foreignKey: "sportsbookId",
|
62
|
+
sourceKey: "id",
|
63
|
+
onDelete: "NO ACTION",
|
64
|
+
constraints: false,
|
65
|
+
});
|
66
|
+
|
67
|
+
Market.belongsToMany(Sportsbook, {
|
68
|
+
through: SportsbookOnMarket,
|
69
|
+
foreignKey: "marketId",
|
70
|
+
sourceKey: "id",
|
71
|
+
onDelete: "NO ACTION",
|
72
|
+
constraints: false,
|
73
|
+
});
|
74
|
+
|
75
|
+
export default SportsbookOnMarket;
|