@winible/winible-typed 2.70.4 → 2.71.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.
Files changed (48) hide show
  1. package/dist/scripts/testModels.js +55 -45
  2. package/dist/scripts/testModels.js.map +1 -1
  3. package/dist/src/types.js +24 -1
  4. package/dist/src/types.js.map +1 -1
  5. package/dist/typed-model/affiliate-link.js +79 -0
  6. package/dist/typed-model/affiliate-link.js.map +1 -0
  7. package/dist/typed-model/bet-sport.js +42 -0
  8. package/dist/typed-model/bet-sport.js.map +1 -0
  9. package/dist/typed-model/bet.js +8 -66
  10. package/dist/typed-model/bet.js.map +1 -1
  11. package/dist/typed-model/index.js +24 -6
  12. package/dist/typed-model/index.js.map +1 -1
  13. package/dist/typed-model/league.js +38 -5
  14. package/dist/typed-model/league.js.map +1 -1
  15. package/dist/typed-model/market-on-bet-sport.js +58 -0
  16. package/dist/typed-model/market-on-bet-sport.js.map +1 -0
  17. package/dist/typed-model/market.js +37 -0
  18. package/dist/typed-model/market.js.map +1 -0
  19. package/dist/typed-model/odd.js +129 -0
  20. package/dist/typed-model/odd.js.map +1 -0
  21. package/dist/typed-model/odds-on-bets.js +53 -0
  22. package/dist/typed-model/odds-on-bets.js.map +1 -0
  23. package/dist/typed-model/odds-on-parlays.js +53 -0
  24. package/dist/typed-model/odds-on-parlays.js.map +1 -0
  25. package/dist/typed-model/parlay.js +55 -0
  26. package/dist/typed-model/parlay.js.map +1 -0
  27. package/dist/typed-model/parlays-on-bets.js +53 -0
  28. package/dist/typed-model/parlays-on-bets.js.map +1 -0
  29. package/dist/typed-model/sportsbook.js +56 -0
  30. package/dist/typed-model/sportsbook.js.map +1 -0
  31. package/dist/typed-model/user.js +1 -1
  32. package/package.json +1 -1
  33. package/src/types.ts +46 -0
  34. package/typed-model/affiliate-link.ts +104 -0
  35. package/typed-model/bet-sport.ts +61 -0
  36. package/typed-model/bet.ts +10 -89
  37. package/typed-model/index.ts +11 -2
  38. package/typed-model/league.ts +46 -7
  39. package/typed-model/market-on-bet-sport.ts +76 -0
  40. package/typed-model/market.ts +55 -0
  41. package/typed-model/odd.ts +158 -0
  42. package/typed-model/odds-on-bets.ts +68 -0
  43. package/typed-model/odds-on-parlays.ts +68 -0
  44. package/typed-model/parlay.ts +74 -0
  45. package/typed-model/parlays-on-bets.ts +69 -0
  46. package/typed-model/sportsbook.ts +78 -0
  47. package/typed-model/user.ts +1 -1
  48. package/typed-model/league-on-users.ts +0 -81
@@ -0,0 +1,68 @@
1
+ import {
2
+ Model,
3
+ InferAttributes,
4
+ InferCreationAttributes,
5
+ DataTypes,
6
+ } from "sequelize";
7
+
8
+ import sequelize from "./pb-sequelize";
9
+ import Odd from "./odd";
10
+ import Parlay from "./parlay";
11
+
12
+ // order of InferAttributes & InferCreationAttributes is important.
13
+ class OddsOnParlays extends Model<
14
+ InferAttributes<OddsOnParlays>,
15
+ InferCreationAttributes<OddsOnParlays>
16
+ > {
17
+ // 'CreationOptional' is a special type that marks the field as optional
18
+ // when creating an instance of the model (such as using Model.create()).
19
+ declare parlayId: string;
20
+ declare oddId: string;
21
+ }
22
+
23
+ OddsOnParlays.init(
24
+ {
25
+ parlayId: {
26
+ type: DataTypes.BIGINT,
27
+ allowNull: false,
28
+ references: {
29
+ model: Parlay,
30
+ key: "id",
31
+ },
32
+ field: "parlay_id",
33
+ },
34
+ oddId: {
35
+ type: DataTypes.BIGINT,
36
+ allowNull: false,
37
+ references: {
38
+ model: Odd,
39
+ key: "id",
40
+ },
41
+ field: "odd_id",
42
+ },
43
+ },
44
+ {
45
+ tableName: "odds_on_parlays",
46
+ comment: "Junction table that relates odds to a parlay",
47
+ timestamps: false,
48
+ sequelize,
49
+ }
50
+ );
51
+
52
+ Parlay.belongsToMany(Odd, {
53
+ through: OddsOnParlays,
54
+ foreignKey: "parlayId",
55
+ sourceKey: "id",
56
+ onDelete: "NO ACTION",
57
+ constraints: false,
58
+ });
59
+
60
+ Odd.belongsToMany(Parlay, {
61
+ through: OddsOnParlays,
62
+ foreignKey: "oddId",
63
+ sourceKey: "id",
64
+ onDelete: "NO ACTION",
65
+ constraints: false,
66
+ });
67
+
68
+ export default OddsOnParlays;
@@ -0,0 +1,74 @@
1
+ import {
2
+ Model,
3
+ InferAttributes,
4
+ InferCreationAttributes,
5
+ CreationOptional,
6
+ DataTypes,
7
+ } from "sequelize";
8
+
9
+ import sequelize from "./pb-sequelize";
10
+ import Sportsbook from "./sportsbook";
11
+
12
+ // order of InferAttributes & InferCreationAttributes is important.
13
+ class Parlay extends Model<
14
+ InferAttributes<Parlay>,
15
+ InferCreationAttributes<Parlay>
16
+ > {
17
+ declare id: CreationOptional<string>;
18
+ declare sportsbookId: string;
19
+ declare price: string;
20
+ declare deepLink: any;
21
+ declare rawResponse: any;
22
+ declare createdAt: CreationOptional<Date>;
23
+ declare updatedAt: CreationOptional<Date>;
24
+ }
25
+
26
+ Parlay.init(
27
+ {
28
+ id: {
29
+ type: DataTypes.STRING,
30
+ primaryKey: true,
31
+ allowNull: false,
32
+ },
33
+ sportsbookId: {
34
+ type: DataTypes.STRING,
35
+ allowNull: false,
36
+ field: "sportsbook_id",
37
+ references: {
38
+ model: Sportsbook,
39
+ key: "id",
40
+ },
41
+ },
42
+ price: {
43
+ type: DataTypes.STRING,
44
+ allowNull: false,
45
+ },
46
+ deepLink: {
47
+ type: DataTypes.JSON,
48
+ allowNull: false,
49
+ field: "deep_link",
50
+ },
51
+ rawResponse: {
52
+ type: DataTypes.JSON,
53
+ allowNull: false,
54
+ field: "raw_response",
55
+ },
56
+ createdAt: DataTypes.DATE,
57
+ updatedAt: DataTypes.DATE,
58
+ },
59
+ {
60
+ tableName: "parlays",
61
+ comment:
62
+ "Parlays table, belongs to a bet and holds the deep_link to the parlay",
63
+ sequelize,
64
+ }
65
+ );
66
+
67
+ Sportsbook.hasMany(Parlay, {
68
+ foreignKey: "sportsbookId",
69
+ sourceKey: "id",
70
+ onDelete: "NO ACTION",
71
+ constraints: false,
72
+ });
73
+
74
+ export default Parlay;
@@ -0,0 +1,69 @@
1
+ import {
2
+ Model,
3
+ InferAttributes,
4
+ InferCreationAttributes,
5
+ DataTypes,
6
+ } from "sequelize";
7
+
8
+ import sequelize from "./pb-sequelize";
9
+ import Bet from "./bet";
10
+ import Odd from "./odd";
11
+ import Parlay from "./parlay";
12
+
13
+ // order of InferAttributes & InferCreationAttributes is important.
14
+ class ParlaysOnBets extends Model<
15
+ InferAttributes<ParlaysOnBets>,
16
+ InferCreationAttributes<ParlaysOnBets>
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 betId: string;
21
+ declare parlayId: string;
22
+ }
23
+
24
+ ParlaysOnBets.init(
25
+ {
26
+ betId: {
27
+ type: DataTypes.BIGINT,
28
+ allowNull: false,
29
+ references: {
30
+ model: Bet,
31
+ key: "id",
32
+ },
33
+ field: "bet_id",
34
+ },
35
+ parlayId: {
36
+ type: DataTypes.BIGINT,
37
+ allowNull: false,
38
+ references: {
39
+ model: Parlay,
40
+ key: "id",
41
+ },
42
+ field: "parlay_id",
43
+ },
44
+ },
45
+ {
46
+ tableName: "parlays_on_bets",
47
+ comment: "Junction table that relates a parlay to a type=parlay bet",
48
+ timestamps: false,
49
+ sequelize,
50
+ }
51
+ );
52
+
53
+ Bet.belongsToMany(Parlay, {
54
+ through: ParlaysOnBets,
55
+ foreignKey: "betId",
56
+ sourceKey: "id",
57
+ onDelete: "NO ACTION",
58
+ constraints: false,
59
+ });
60
+
61
+ Parlay.belongsToMany(Bet, {
62
+ through: ParlaysOnBets,
63
+ foreignKey: "parlayId",
64
+ sourceKey: "id",
65
+ onDelete: "NO ACTION",
66
+ constraints: false,
67
+ });
68
+
69
+ export default ParlaysOnBets;
@@ -0,0 +1,78 @@
1
+ import {
2
+ Model,
3
+ InferAttributes,
4
+ InferCreationAttributes,
5
+ CreationOptional,
6
+ DataTypes,
7
+ fn,
8
+ } from "sequelize";
9
+
10
+ import sequelize from "./pb-sequelize";
11
+ import { StatusType } from "../src/types";
12
+
13
+ // order of InferAttributes & InferCreationAttributes is important.
14
+ class Sportsbook extends Model<
15
+ InferAttributes<Sportsbook>,
16
+ InferCreationAttributes<Sportsbook>
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 id: CreationOptional<string>;
21
+ declare name: string;
22
+ declare status: StatusType;
23
+ declare numericalId: number;
24
+ declare logo: string;
25
+ declare isOnshore: boolean;
26
+ declare isOffshore: boolean;
27
+ declare createdAt: CreationOptional<Date>;
28
+ declare updatedAt: CreationOptional<Date>;
29
+ }
30
+
31
+ Sportsbook.init(
32
+ {
33
+ id: {
34
+ type: DataTypes.BIGINT,
35
+ primaryKey: true,
36
+ allowNull: false,
37
+ defaultValue: sequelize.fn("next_id"),
38
+ },
39
+ name: {
40
+ type: DataTypes.STRING,
41
+ allowNull: false,
42
+ },
43
+ status: {
44
+ type: DataTypes.ENUM(...Object.values(StatusType)),
45
+ allowNull: false,
46
+ },
47
+ numericalId: {
48
+ type: DataTypes.INTEGER,
49
+ allowNull: false,
50
+ comment: "Numerical ID provided by Odds Jam",
51
+ field: "numerical_id",
52
+ },
53
+ logo: {
54
+ type: DataTypes.STRING,
55
+ allowNull: false,
56
+ },
57
+ isOnshore: {
58
+ type: DataTypes.BOOLEAN,
59
+ allowNull: false,
60
+ field: "is_onshore",
61
+ },
62
+ isOffshore: {
63
+ type: DataTypes.BOOLEAN,
64
+ allowNull: false,
65
+ field: "is_offshore",
66
+ },
67
+ createdAt: DataTypes.DATE,
68
+ updatedAt: DataTypes.DATE,
69
+ },
70
+ {
71
+ // Other model options go here
72
+ tableName: "sportsbooks",
73
+ comment: "Sportsbooks synched from Odds Jam",
74
+ sequelize,
75
+ }
76
+ );
77
+
78
+ export default Sportsbook;
@@ -186,7 +186,7 @@ User.init(
186
186
  platformFee: {
187
187
  type: DataTypes.INTEGER,
188
188
  field: "platform_fee",
189
- defaultValue: 20,
189
+ defaultValue: 15,
190
190
  },
191
191
  profileViews: {
192
192
  type: DataTypes.INTEGER,
@@ -1,81 +0,0 @@
1
- import {
2
- Model,
3
- InferAttributes,
4
- InferCreationAttributes,
5
- CreationOptional,
6
- DataTypes,
7
- } from "sequelize";
8
- import League from "./league";
9
-
10
- import sequelize from "./pb-sequelize";
11
- import User from "./user";
12
-
13
- // order of InferAttributes & InferCreationAttributes is important.
14
- class LeagueOnUsers extends Model<
15
- InferAttributes<LeagueOnUsers>,
16
- InferCreationAttributes<LeagueOnUsers>
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 id: CreationOptional<string>;
21
- declare leagueId: string;
22
- declare userId: string;
23
- declare createdAt: CreationOptional<Date>;
24
- declare updatedAt: CreationOptional<Date>;
25
- }
26
-
27
- LeagueOnUsers.init(
28
- {
29
- id: {
30
- type: DataTypes.BIGINT,
31
- primaryKey: true,
32
- allowNull: false,
33
- defaultValue: sequelize.fn("next_id"),
34
- },
35
- leagueId: {
36
- type: DataTypes.BIGINT,
37
- field: "league_id",
38
- allowNull: false,
39
- },
40
- userId: {
41
- type: DataTypes.BIGINT,
42
- field: "user_id",
43
- allowNull: false,
44
- },
45
- createdAt: DataTypes.DATE,
46
- updatedAt: DataTypes.DATE,
47
- },
48
- {
49
- // Other model options go here
50
- tableName: "league_on_users",
51
- sequelize,
52
- }
53
- );
54
-
55
- LeagueOnUsers.hasOne(League, {
56
- foreignKey: "id",
57
- sourceKey: "leagueId",
58
- onDelete: "NO ACTION",
59
- constraints: false,
60
- });
61
-
62
- League.hasMany(LeagueOnUsers, {
63
- foreignKey: "leagueId",
64
- onDelete: "NO ACTION",
65
- constraints: false,
66
- });
67
-
68
- LeagueOnUsers.hasOne(User, {
69
- foreignKey: "id",
70
- sourceKey: "userId",
71
- onDelete: "NO ACTION",
72
- constraints: false,
73
- });
74
-
75
- User.hasMany(LeagueOnUsers, {
76
- foreignKey: "userId",
77
- onDelete: "NO ACTION",
78
- constraints: false,
79
- });
80
-
81
- export default LeagueOnUsers;