@winible/winible-typed 1.0.10 → 2.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.
Files changed (224) hide show
  1. package/dist/migrations/20230330174702-extend-premium-content.js +35 -0
  2. package/dist/migrations/20230330174702-extend-premium-content.js.map +1 -0
  3. package/dist/migrations/20230405141245-deprecate-agencies.js +9 -0
  4. package/dist/migrations/20230405141245-deprecate-agencies.js.map +1 -0
  5. package/dist/migrations/20230405142440-deprecate-unused-tables.js +23 -0
  6. package/dist/migrations/20230405142440-deprecate-unused-tables.js.map +1 -0
  7. package/dist/migrations/20230410144940-deprecate-consent-people.js +9 -0
  8. package/dist/migrations/20230410144940-deprecate-consent-people.js.map +1 -0
  9. package/dist/migrations/20230410174328-deprecate-consent-people-table.js +9 -0
  10. package/dist/migrations/20230410174328-deprecate-consent-people-table.js.map +1 -0
  11. package/dist/migrations/20230410181920-migrate-credit-payments-to-transactions.js +9 -0
  12. package/dist/migrations/20230410181920-migrate-credit-payments-to-transactions.js.map +1 -0
  13. package/dist/migrations/20230410202433-migrate-credit-payments-fields.js +12 -0
  14. package/dist/migrations/20230410202433-migrate-credit-payments-fields.js.map +1 -0
  15. package/dist/migrations/20230410211059-deprecate-credit-purchases.js +9 -0
  16. package/dist/migrations/20230410211059-deprecate-credit-purchases.js.map +1 -0
  17. package/dist/migrations/20230410212035-deprecate-dashboard_user_permissions.js +10 -0
  18. package/dist/migrations/20230410212035-deprecate-dashboard_user_permissions.js.map +1 -0
  19. package/dist/migrations/20230410212324-deprecate-non-breaking-tables.js +34 -0
  20. package/dist/migrations/20230410212324-deprecate-non-breaking-tables.js.map +1 -0
  21. package/dist/migrations/20230411054826-create-users-table.js +141 -0
  22. package/dist/migrations/20230411054826-create-users-table.js.map +1 -0
  23. package/dist/migrations/20230411202848-migrate_transactions_table.js +24 -0
  24. package/dist/migrations/20230411202848-migrate_transactions_table.js.map +1 -0
  25. package/dist/migrations/20230411203543-migrate_league_users.js +9 -0
  26. package/dist/migrations/20230411203543-migrate_league_users.js.map +1 -0
  27. package/dist/migrations/20230411205324-migrate_league.js +13 -0
  28. package/dist/migrations/20230411205324-migrate_league.js.map +1 -0
  29. package/dist/migrations/20230411221159-migrate_media.js +9 -0
  30. package/dist/migrations/20230411221159-migrate_media.js.map +1 -0
  31. package/dist/migrations/20230411221327-migrate_media_asset.js +10 -0
  32. package/dist/migrations/20230411221327-migrate_media_asset.js.map +1 -0
  33. package/dist/migrations/20230411221842-migrate_media_asset_fields.js +10 -0
  34. package/dist/migrations/20230411221842-migrate_media_asset_fields.js.map +1 -0
  35. package/dist/migrations/20230411222018-migrate_notifications.js +25 -0
  36. package/dist/migrations/20230411222018-migrate_notifications.js.map +1 -0
  37. package/dist/scripts/cleanupRecurlyPlans.js +12 -5
  38. package/dist/scripts/cleanupRecurlyPlans.js.map +1 -1
  39. package/dist/scripts/mapCurrentPaymentsToInvoiceId.js +12 -5
  40. package/dist/scripts/mapCurrentPaymentsToInvoiceId.js.map +1 -1
  41. package/dist/src/index.js +1 -18
  42. package/dist/src/index.js.map +1 -1
  43. package/dist/typed-model/credit-payment.js +133 -82
  44. package/dist/typed-model/credit-payment.js.map +1 -1
  45. package/dist/typed-model/index.js +3 -81
  46. package/dist/typed-model/index.js.map +1 -1
  47. package/dist/typed-model/league-user.js +28 -4
  48. package/dist/typed-model/league-user.js.map +1 -1
  49. package/dist/typed-model/media-asset.js +0 -9
  50. package/dist/typed-model/media-asset.js.map +1 -1
  51. package/dist/typed-model/notification.js +34 -24
  52. package/dist/typed-model/notification.js.map +1 -1
  53. package/dist/typed-model/pb-sequelize.js +18 -4
  54. package/dist/typed-model/pb-sequelize.js.map +1 -1
  55. package/dist/typed-model/subscription-plan-on-premium-content.js +57 -0
  56. package/dist/typed-model/subscription-plan-on-premium-content.js.map +1 -0
  57. package/dist/typed-model/subscription-plan.js +0 -9
  58. package/dist/typed-model/subscription-plan.js.map +1 -1
  59. package/dist/typed-model/subscription.js +0 -14
  60. package/dist/typed-model/subscription.js.map +1 -1
  61. package/dist/typed-model/user.js +194 -0
  62. package/dist/typed-model/user.js.map +1 -0
  63. package/package.json +3 -2
  64. package/src/index.ts +0 -2
  65. package/typed-model/credit-payment.ts +124 -126
  66. package/typed-model/index.ts +1 -51
  67. package/typed-model/media-asset.ts +0 -10
  68. package/typed-model/notification.ts +39 -44
  69. package/typed-model/pb-sequelize.ts +18 -4
  70. package/typed-model/subscription-plan.ts +0 -10
  71. package/typed-model/subscription.ts +1 -15
  72. package/typed-model/user.ts +248 -0
  73. package/dist/index.d.ts +0 -3
  74. package/dist/migrations/20220601151258-custom_name_describing_your_migration.d.ts +0 -6
  75. package/dist/migrations/20220605225655-create-dashboard-user-permissions.d.ts +0 -6
  76. package/dist/migrations/20220606001300-update-dashboard-user-permissions.d.ts +0 -6
  77. package/dist/migrations/20220607091109-add-read-date-for-message.d.ts +0 -6
  78. package/dist/migrations/20220616225456-add-delete-columns.d.ts +0 -6
  79. package/dist/migrations/20220709202211-disable-feed.d.ts +0 -6
  80. package/dist/migrations/20220723215213-limit-promotion-claims.d.ts +0 -6
  81. package/dist/migrations/20220723220233-num_claims.d.ts +0 -6
  82. package/dist/migrations/20220723221907-default_false_promos.d.ts +0 -6
  83. package/dist/migrations/20220724172559-default_zero_claims.d.ts +0 -6
  84. package/dist/migrations/20220724201419-pinned_post.d.ts +0 -6
  85. package/dist/migrations/20220729164625-unsend_mass.d.ts +0 -6
  86. package/dist/migrations/20220823033002-interval-unit.d.ts +0 -6
  87. package/dist/migrations/20220830193530-processorId.d.ts +0 -6
  88. package/dist/migrations/20220907121932-add-processor-to-sub.d.ts +0 -6
  89. package/dist/migrations/20220907212232-add-trans-id.d.ts +0 -6
  90. package/dist/migrations/20220907220423-big-int-trans.d.ts +0 -6
  91. package/dist/migrations/20220909161902-add-stale.d.ts +0 -6
  92. package/dist/migrations/20220922000225-verified-spender.d.ts +0 -6
  93. package/dist/migrations/20220922212108-verified-spender-2.d.ts +0 -6
  94. package/dist/migrations/20221013223648-product-subscription-list.d.ts +0 -6
  95. package/dist/migrations/20221014001037-product-subscription-list.d.ts +0 -6
  96. package/dist/migrations/20221026055245-update-type.d.ts +0 -6
  97. package/dist/migrations/20221108060019-recurly-sub.d.ts +0 -6
  98. package/dist/migrations/20221110170148-rename-recurly-account.d.ts +0 -6
  99. package/dist/migrations/20221112212510-archive-promo.d.ts +0 -6
  100. package/dist/migrations/20221117044529-sub-status.d.ts +0 -6
  101. package/dist/migrations/20221122051433-default-plan.d.ts +0 -6
  102. package/dist/migrations/20221128034620-invoice-id.d.ts +0 -6
  103. package/dist/migrations/20230313175014-league-user.js +0 -27
  104. package/dist/migrations/20230313175014-league-user.js.map +0 -1
  105. package/dist/scripts/bet-syncing/checkForPrizePicks.js +0 -85
  106. package/dist/scripts/bet-syncing/checkForPrizePicks.js.map +0 -1
  107. package/dist/scripts/bet-syncing/pullTeams.d.ts +0 -1
  108. package/dist/scripts/cleanupRecurlyPlans.d.ts +0 -1
  109. package/dist/scripts/createDashboardLink.d.ts +0 -1
  110. package/dist/scripts/createRecurlyPlans.d.ts +0 -1
  111. package/dist/scripts/deleteMalformedImages.d.ts +0 -1
  112. package/dist/scripts/fixSaltedPasswords.js +0 -40
  113. package/dist/scripts/fixSaltedPasswords.js.map +0 -1
  114. package/dist/scripts/mapCurrentPaymentsToInvoiceId.d.ts +0 -1
  115. package/dist/scripts/payoutRecurlySubs.d.ts +0 -1
  116. package/dist/scripts/payoutSubscriptions.d.ts +0 -1
  117. package/dist/scripts/removeUnreferenceSubs.d.ts +0 -1
  118. package/dist/scripts/test.d.ts +0 -1
  119. package/dist/slack/index.d.ts +0 -1
  120. package/dist/slack/v1/bypassCreator.d.ts +0 -8
  121. package/dist/slack/v1/cancelSubscription.d.ts +0 -6
  122. package/dist/slack/v1/changeName.d.ts +0 -8
  123. package/dist/slack/v1/checkAuthSub.d.ts +0 -6
  124. package/dist/slack/v1/dashboardLink.d.ts +0 -8
  125. package/dist/slack/v1/index.d.ts +0 -7
  126. package/dist/slack/v1/refund.d.ts +0 -6
  127. package/dist/slack/v1/searchUser.d.ts +0 -6
  128. package/dist/src/index.d.ts +0 -3
  129. package/dist/src/pk-client.d.ts +0 -151
  130. package/dist/src/pk-sub.d.ts +0 -77
  131. package/dist/src/recurlyInstance.d.ts +0 -3
  132. package/dist/src/types.d.ts +0 -30
  133. package/dist/support/index.d.ts +0 -2
  134. package/dist/support/slack-client.d.ts +0 -3
  135. package/dist/support/uploadcare.d.ts +0 -14
  136. package/dist/support/utils.d.ts +0 -2
  137. package/dist/typed-model/asset-category.d.ts +0 -9
  138. package/dist/typed-model/asset-constent-person.d.ts +0 -13
  139. package/dist/typed-model/bet.d.ts +0 -12
  140. package/dist/typed-model/blocked-ip.d.ts +0 -8
  141. package/dist/typed-model/category-tag.d.ts +0 -9
  142. package/dist/typed-model/consent-person.d.ts +0 -13
  143. package/dist/typed-model/content-category-tag.d.ts +0 -9
  144. package/dist/typed-model/content-like.d.ts +0 -10
  145. package/dist/typed-model/credit-payment.d.ts +0 -34
  146. package/dist/typed-model/credit-payout.d.ts +0 -10
  147. package/dist/typed-model/credit-purchase.d.ts +0 -10
  148. package/dist/typed-model/customer-profile.d.ts +0 -17
  149. package/dist/typed-model/dashboard-user-permissions.d.ts +0 -9
  150. package/dist/typed-model/dashboard-user.d.ts +0 -20
  151. package/dist/typed-model/fan-list.d.ts +0 -10
  152. package/dist/typed-model/fraud.d.ts +0 -9
  153. package/dist/typed-model/game.d.ts +0 -56
  154. package/dist/typed-model/index.d.ts +0 -46
  155. package/dist/typed-model/league.d.ts +0 -9
  156. package/dist/typed-model/list-member.d.ts +0 -9
  157. package/dist/typed-model/mass-message.d.ts +0 -11
  158. package/dist/typed-model/media-asset.d.ts +0 -15
  159. package/dist/typed-model/media-category.d.ts +0 -10
  160. package/dist/typed-model/media.d.ts +0 -14
  161. package/dist/typed-model/message-media.d.ts +0 -9
  162. package/dist/typed-model/message.d.ts +0 -27
  163. package/dist/typed-model/notification.d.ts +0 -18
  164. package/dist/typed-model/odds.d.ts +0 -30
  165. package/dist/typed-model/parlay.d.ts +0 -8
  166. package/dist/typed-model/pb-sequelize.d.ts +0 -3
  167. package/dist/typed-model/phone-chat-participation.d.ts +0 -20
  168. package/dist/typed-model/phone-chat.d.ts +0 -16
  169. package/dist/typed-model/phone-owner.d.ts +0 -53
  170. package/dist/typed-model/phone-user.d.ts +0 -21
  171. package/dist/typed-model/player.d.ts +0 -22
  172. package/dist/typed-model/premium-content.d.ts +0 -23
  173. package/dist/typed-model/purchased-content.d.ts +0 -11
  174. package/dist/typed-model/recurly-account.d.ts +0 -9
  175. package/dist/typed-model/short-url.d.ts +0 -12
  176. package/dist/typed-model/subscription-bundle.d.ts +0 -12
  177. package/dist/typed-model/subscription-category-tags.d.ts +0 -9
  178. package/dist/typed-model/subscription-plan.d.ts +0 -27
  179. package/dist/typed-model/subscription-promotion.d.ts +0 -19
  180. package/dist/typed-model/subscription.d.ts +0 -26
  181. package/dist/typed-model/team.d.ts +0 -16
  182. package/dist/typed-model/twilio-phone.d.ts +0 -17
  183. package/dist/typed-model/user-follow.d.ts +0 -13
  184. package/dist/typed-model/verification-code.d.ts +0 -11
  185. package/dist/webhooks/index.d.ts +0 -1
  186. package/dist/webhooks/payment/index.d.ts +0 -1
  187. package/dist/webhooks/payment/refund.d.ts +0 -2
  188. package/src/pk-client.ts +0 -1650
  189. package/src/pk-sub.ts +0 -455
  190. package/typed-model/asset-category.ts +0 -57
  191. package/typed-model/asset-constent-person.ts +0 -82
  192. package/typed-model/bet.ts +0 -84
  193. package/typed-model/blocked-ip.ts +0 -52
  194. package/typed-model/category-tag.ts +0 -66
  195. package/typed-model/consent-person.ts +0 -78
  196. package/typed-model/content-category-tag.ts +0 -79
  197. package/typed-model/credit-purchase.ts +0 -67
  198. package/typed-model/customer-profile.ts +0 -71
  199. package/typed-model/dashboard-user-permissions.ts +0 -51
  200. package/typed-model/dashboard-user.ts +0 -146
  201. package/typed-model/fan-list.ts +0 -68
  202. package/typed-model/fraud.ts +0 -62
  203. package/typed-model/game.ts +0 -311
  204. package/typed-model/list-member.ts +0 -67
  205. package/typed-model/market.ts +0 -54
  206. package/typed-model/mass-message.ts +0 -64
  207. package/typed-model/media-category.ts +0 -70
  208. package/typed-model/message-media.ts +0 -74
  209. package/typed-model/message.ts +0 -258
  210. package/typed-model/odds.ts +0 -238
  211. package/typed-model/parlay.ts +0 -47
  212. package/typed-model/phone-chat-participation.ts +0 -166
  213. package/typed-model/phone-chat.ts +0 -185
  214. package/typed-model/player-result.ts +0 -93
  215. package/typed-model/player.ts +0 -118
  216. package/typed-model/short-url.ts +0 -120
  217. package/typed-model/sportsbook.ts +0 -48
  218. package/typed-model/subscription-bundle.ts +0 -80
  219. package/typed-model/subscription-category-tags.ts +0 -79
  220. package/typed-model/subscription-promotion.ts +0 -134
  221. package/typed-model/team.ts +0 -91
  222. package/typed-model/twilio-phone.ts +0 -149
  223. package/typed-model/user-follow.ts +0 -141
  224. package/typed-model/verification-code.ts +0 -74
@@ -1,52 +0,0 @@
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
-
12
- // order of InferAttributes & InferCreationAttributes is important.
13
- class BlockedIP extends Model<
14
- InferAttributes<BlockedIP>,
15
- InferCreationAttributes<BlockedIP>
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 id: CreationOptional<string>;
20
- declare ipAddress: string;
21
- declare createdAt: CreationOptional<Date>;
22
- declare updatedAt: CreationOptional<Date>;
23
- }
24
-
25
- BlockedIP.init(
26
- {
27
- id: {
28
- type: DataTypes.BIGINT,
29
- primaryKey: true,
30
- allowNull: false,
31
- defaultValue: sequelize.fn("next_id"),
32
- },
33
- ipAddress: {
34
- type: DataTypes.STRING,
35
- field: "ip_address",
36
- },
37
- createdAt: DataTypes.DATE,
38
- updatedAt: DataTypes.DATE,
39
- },
40
- {
41
- tableName: "blocked_ips",
42
- sequelize,
43
- }
44
- );
45
-
46
- /*
47
- ====================================================================
48
- Class functions
49
- ====================================================================
50
- */
51
-
52
- export default BlockedIP;
@@ -1,66 +0,0 @@
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 PhoneOwner from "./phone-owner";
12
-
13
- // order of InferAttributes & InferCreationAttributes is important.
14
- class CategoryTag extends Model<
15
- InferAttributes<CategoryTag>,
16
- InferCreationAttributes<CategoryTag>
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 ownerId: string;
22
- declare name: string;
23
-
24
- declare createdAt: CreationOptional<Date>;
25
- declare updatedAt: CreationOptional<Date>;
26
- }
27
-
28
- CategoryTag.init(
29
- {
30
- id: {
31
- type: DataTypes.BIGINT,
32
- primaryKey: true,
33
- allowNull: false,
34
- defaultValue: sequelize.fn("next_id"),
35
- },
36
- ownerId: {
37
- type: DataTypes.BIGINT,
38
- field: "owner_id",
39
- },
40
- name: {
41
- type: DataTypes.STRING,
42
- field: "name",
43
- },
44
- createdAt: DataTypes.DATE,
45
- updatedAt: DataTypes.DATE,
46
- },
47
- {
48
- sequelize,
49
- tableName: "category_tags",
50
- // Other model options go here
51
- }
52
- );
53
-
54
- PhoneOwner.hasMany(CategoryTag, {
55
- foreignKey: "owner_id",
56
- onDelete: "NO ACTION",
57
- constraints: false,
58
- });
59
- CategoryTag.hasOne(PhoneOwner, {
60
- foreignKey: "id",
61
- sourceKey: "owner_id",
62
- onDelete: "NO ACTION",
63
- constraints: false,
64
- });
65
-
66
- export default CategoryTag;
@@ -1,78 +0,0 @@
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
-
12
- // order of InferAttributes & InferCreationAttributes is important.
13
- class ConsentPerson extends Model<
14
- InferAttributes<ConsentPerson>,
15
- InferCreationAttributes<ConsentPerson>
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 id: CreationOptional<string>;
20
- declare ownerId: string;
21
- declare fullName: string;
22
- declare birthday: Date;
23
- declare consentFormKey: string;
24
- declare idImageKey: string;
25
- declare reviewStatus: "pending" | "approved";
26
- declare createdAt: CreationOptional<Date>;
27
- declare updatedAt: CreationOptional<Date>;
28
- }
29
-
30
- ConsentPerson.init(
31
- {
32
- id: {
33
- type: DataTypes.BIGINT,
34
- primaryKey: true,
35
- allowNull: false,
36
- defaultValue: fn("next_id"),
37
- },
38
- ownerId: {
39
- type: DataTypes.BIGINT,
40
- field: "owner_id",
41
- },
42
- fullName: {
43
- type: DataTypes.STRING,
44
- field: "full_name",
45
- },
46
- birthday: {
47
- type: DataTypes.DATE,
48
- field: "birthday",
49
- },
50
- consentFormKey: {
51
- type: DataTypes.STRING,
52
- field: "consent_form_key",
53
- },
54
- idImageKey: {
55
- type: DataTypes.STRING,
56
- field: "id_image_key",
57
- },
58
- reviewStatus: {
59
- type: DataTypes.STRING,
60
- field: "review_status",
61
- defaultValue: "pending",
62
- },
63
- createdAt: DataTypes.DATE,
64
- updatedAt: DataTypes.DATE,
65
- },
66
- {
67
- sequelize,
68
- tableName: "consent_people",
69
- }
70
- );
71
-
72
- /*
73
- ====================================================================
74
- Class functions
75
- ====================================================================
76
- */
77
-
78
- export default ConsentPerson;
@@ -1,79 +0,0 @@
1
- import {
2
- Model,
3
- InferAttributes,
4
- InferCreationAttributes,
5
- CreationOptional,
6
- DataTypes,
7
- fn,
8
- } from "sequelize";
9
- import CategoryTag from "./category-tag";
10
-
11
- import sequelize from "./pb-sequelize";
12
- import PremiumContent from "./premium-content";
13
-
14
- // order of InferAttributes & InferCreationAttributes is important.
15
- class ContentCategoryTag extends Model<
16
- InferAttributes<ContentCategoryTag>,
17
- InferCreationAttributes<ContentCategoryTag>
18
- > {
19
- // 'CreationOptional' is a special type that marks the field as optional
20
- // when creating an instance of the model (such as using Model.create()).
21
- declare id: CreationOptional<string>;
22
- declare contentId: string;
23
- declare tagId: string;
24
-
25
- declare createdAt: CreationOptional<Date>;
26
- declare updatedAt: CreationOptional<Date>;
27
- }
28
-
29
- ContentCategoryTag.init(
30
- {
31
- id: {
32
- type: DataTypes.BIGINT,
33
- primaryKey: true,
34
- allowNull: false,
35
- defaultValue: sequelize.fn("next_id"),
36
- },
37
- contentId: {
38
- type: DataTypes.BIGINT,
39
- field: "content_id",
40
- },
41
- tagId: {
42
- type: DataTypes.BIGINT,
43
- field: "tag_id",
44
- },
45
- createdAt: DataTypes.DATE,
46
- updatedAt: DataTypes.DATE,
47
- },
48
- {
49
- sequelize,
50
- tableName: "content_category_tags",
51
- // Other model options go here
52
- }
53
- );
54
-
55
- PremiumContent.hasMany(ContentCategoryTag, {
56
- foreignKey: "content_id",
57
- onDelete: "NO ACTION",
58
- constraints: false,
59
- });
60
- ContentCategoryTag.hasOne(PremiumContent, {
61
- foreignKey: "id",
62
- sourceKey: "content_id",
63
- onDelete: "NO ACTION",
64
- constraints: false,
65
- });
66
-
67
- CategoryTag.hasMany(ContentCategoryTag, {
68
- foreignKey: "tag_id",
69
- onDelete: "NO ACTION",
70
- constraints: false,
71
- });
72
- ContentCategoryTag.hasOne(CategoryTag, {
73
- foreignKey: "id",
74
- sourceKey: "tag_id",
75
- onDelete: "NO ACTION",
76
- constraints: false,
77
- });
78
-
79
- export default ContentCategoryTag;
@@ -1,67 +0,0 @@
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
-
12
- // order of InferAttributes & InferCreationAttributes is important.
13
- class CreditPurchase extends Model<
14
- InferAttributes<CreditPurchase>,
15
- InferCreationAttributes<CreditPurchase>
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 id: CreationOptional<string>;
20
- declare userId: string;
21
- declare creditAmountInCents: number;
22
- declare createdAt: CreationOptional<Date>;
23
- declare updatedAt: CreationOptional<Date>;
24
- static getById: (id: string) => Promise<CreditPurchase | null>;
25
- }
26
-
27
- CreditPurchase.init(
28
- {
29
- id: {
30
- type: DataTypes.BIGINT,
31
- primaryKey: true,
32
- allowNull: false,
33
- defaultValue: sequelize.fn("next_id"),
34
- },
35
- userId: {
36
- type: DataTypes.BIGINT,
37
- allowNull: false,
38
- field: "user_id",
39
- },
40
- creditAmountInCents: {
41
- type: DataTypes.INTEGER,
42
- field: "credit_amount_in_cents",
43
- },
44
- createdAt: DataTypes.DATE,
45
- updatedAt: DataTypes.DATE,
46
- },
47
- {
48
- tableName: "credit_purchases",
49
- sequelize,
50
- }
51
- );
52
-
53
- /*
54
- ====================================================================
55
- Class functions
56
- ====================================================================
57
- */
58
-
59
- CreditPurchase.getById = async (id: string) => {
60
- return await CreditPurchase.findOne({
61
- where: {
62
- id,
63
- },
64
- });
65
- };
66
-
67
- export default CreditPurchase;
@@ -1,71 +0,0 @@
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
-
12
- export enum ProcessorId {
13
- HUMBOLDT = "humboldt",
14
- KAJA = "kaja",
15
- KAJACOACHING = "kajacoaching",
16
- RECURLY = "recurly",
17
- }
18
-
19
- // order of InferAttributes & InferCreationAttributes is important.
20
- class PKCustomerProfile extends Model<
21
- InferAttributes<PKCustomerProfile>,
22
- InferCreationAttributes<PKCustomerProfile>
23
- > {
24
- // 'CreationOptional' is a special type that marks the field as optional
25
- // when creating an instance of the model (such as using Model.create()).
26
- declare id: CreationOptional<string>;
27
- declare userId: string;
28
- declare customerProfileId: string;
29
- declare defaultPaymentProfileId?: string;
30
- declare processorId: ProcessorId;
31
- declare createdAt: CreationOptional<Date>;
32
- declare updatedAt: CreationOptional<Date>;
33
- }
34
-
35
- PKCustomerProfile.init(
36
- {
37
- id: {
38
- type: DataTypes.BIGINT,
39
- primaryKey: true,
40
- allowNull: false,
41
- defaultValue: sequelize.fn("next_id"),
42
- },
43
- userId: {
44
- type: DataTypes.BIGINT,
45
- allowNull: false,
46
- field: "user_id",
47
- },
48
- customerProfileId: {
49
- type: DataTypes.STRING,
50
- field: "pk_customer_profile_id",
51
- },
52
- processorId: {
53
- type: DataTypes.STRING,
54
- field: "processor_id",
55
- allowNull: false,
56
- defaultValue: ProcessorId.HUMBOLDT,
57
- },
58
- defaultPaymentProfileId: {
59
- type: DataTypes.STRING,
60
- field: "pk_default_payment_profile_id",
61
- },
62
- createdAt: DataTypes.DATE,
63
- updatedAt: DataTypes.DATE,
64
- },
65
- {
66
- tableName: "pk_customer_profiles",
67
- sequelize,
68
- }
69
- );
70
-
71
- export default PKCustomerProfile;
@@ -1,51 +0,0 @@
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
-
12
- // order of InferAttributes & InferCreationAttributes is important.
13
- class DashboardUserPermissions extends Model<
14
- InferAttributes<DashboardUserPermissions>,
15
- InferCreationAttributes<DashboardUserPermissions>
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 id: CreationOptional<string>;
20
- declare dashboardUserId: string;
21
- declare role: "admin" | "message-only";
22
- declare createdAt: CreationOptional<Date>;
23
- declare updatedAt: CreationOptional<Date>;
24
- }
25
-
26
- DashboardUserPermissions.init(
27
- {
28
- id: {
29
- type: DataTypes.BIGINT,
30
- primaryKey: true,
31
- allowNull: false,
32
- defaultValue: fn("next_id"),
33
- },
34
- dashboardUserId: {
35
- type: new DataTypes.BIGINT(),
36
- allowNull: false,
37
- unique: true,
38
- },
39
- role: {
40
- type: new DataTypes.STRING(30),
41
- allowNull: false,
42
- },
43
- createdAt: DataTypes.DATE,
44
- updatedAt: DataTypes.DATE,
45
- },
46
- {
47
- sequelize,
48
- tableName: "dashboard_user_permissions",
49
- }
50
- );
51
- export default DashboardUserPermissions;
@@ -1,146 +0,0 @@
1
- import {
2
- Model,
3
- InferAttributes,
4
- InferCreationAttributes,
5
- CreationOptional,
6
- DataTypes,
7
- fn,
8
- } from "sequelize";
9
-
10
- import PhoneUser from "./phone-user";
11
- import PhoneOwner from "./phone-owner";
12
-
13
- import sequelize from "./pb-sequelize";
14
-
15
- // order of InferAttributes & InferCreationAttributes is important.
16
- class DashboardUser extends Model<
17
- InferAttributes<DashboardUser>,
18
- InferCreationAttributes<DashboardUser>
19
- > {
20
- // 'CreationOptional' is a special type that marks the field as optional
21
- // when creating an instance of the model (such as using Model.create()).
22
- declare id: CreationOptional<string>;
23
- declare ownerId?: string;
24
- declare userId?: string;
25
- declare email?: string;
26
- declare password?: string;
27
- declare referringOwnerId?: string;
28
- declare name?: string;
29
- declare username?: string;
30
- declare masspayUserToken?: string;
31
- declare deleted?: boolean;
32
- declare emailVerified?: boolean;
33
-
34
- declare createdAt?: Date;
35
- declare updatedAt?: Date;
36
- static getById: (id: string) => Promise<DashboardUser | null>;
37
- static getByEmail: (email: string) => Promise<DashboardUser | null>;
38
- static getAllByOwnerId: (ownerId: string) => Promise<DashboardUser[]>;
39
- }
40
-
41
- DashboardUser.init(
42
- {
43
- id: {
44
- type: DataTypes.BIGINT,
45
- primaryKey: true,
46
- allowNull: false,
47
- defaultValue: fn("next_id"),
48
- },
49
- ownerId: {
50
- type: DataTypes.BIGINT,
51
- field: "phone_owner_id",
52
- },
53
- userId: {
54
- type: DataTypes.BIGINT,
55
- field: "user_id",
56
- },
57
- email: {
58
- type: DataTypes.STRING,
59
- field: "email",
60
- unique: true,
61
- },
62
- password: {
63
- type: DataTypes.STRING,
64
- field: "password",
65
- },
66
- referringOwnerId: {
67
- type: DataTypes.BIGINT,
68
- field: "referring_owner_id",
69
- },
70
- name: {
71
- type: DataTypes.STRING,
72
- field: "name",
73
- },
74
- username: {
75
- type: DataTypes.STRING,
76
- field: "username",
77
- // unique: true,
78
- },
79
- masspayUserToken: {
80
- type: DataTypes.STRING,
81
- field: "masspay_user_token",
82
- unique: true,
83
- },
84
- deleted: {
85
- type: DataTypes.BOOLEAN,
86
- field: "deleted",
87
- defaultValue: false,
88
- },
89
- emailVerified: {
90
- type: DataTypes.BOOLEAN,
91
- field: "email_verified",
92
- defaultValue: false,
93
- },
94
- },
95
- {
96
- tableName: "dashboard_users",
97
- sequelize,
98
- defaultScope: {
99
- attributes: { exclude: ["password"] },
100
- },
101
- }
102
- );
103
-
104
- /*
105
- ====================================================================
106
- Class functions
107
- ====================================================================
108
- */
109
-
110
- DashboardUser.getById = async (id: string) => {
111
- return await DashboardUser.findOne({
112
- where: {
113
- id,
114
- },
115
- });
116
- };
117
-
118
- DashboardUser.getByEmail = async (email: string) => {
119
- return await DashboardUser.findOne({
120
- where: {
121
- email,
122
- },
123
- });
124
- };
125
-
126
- DashboardUser.getAllByOwnerId = async (ownerId: string) => {
127
- return await DashboardUser.findAll({
128
- where: {
129
- ownerId,
130
- },
131
- });
132
- };
133
-
134
- DashboardUser.hasOne(PhoneOwner, {
135
- foreignKey: "id",
136
- sourceKey: "ownerId",
137
- constraints: false,
138
- });
139
-
140
- DashboardUser.hasOne(PhoneUser, {
141
- foreignKey: "id",
142
- sourceKey: "userId",
143
- constraints: false,
144
- });
145
-
146
- export default DashboardUser;
@@ -1,68 +0,0 @@
1
- import {
2
- Model,
3
- InferAttributes,
4
- InferCreationAttributes,
5
- CreationOptional,
6
- DataTypes,
7
- fn,
8
- } from "sequelize";
9
- import ListMember from "./list-member";
10
-
11
- import sequelize from "./pb-sequelize";
12
- import PhoneOwner from "./phone-owner";
13
-
14
- // order of InferAttributes & InferCreationAttributes is important.
15
- class FanList extends Model<
16
- InferAttributes<FanList>,
17
- InferCreationAttributes<FanList>
18
- > {
19
- // 'CreationOptional' is a special type that marks the field as optional
20
- // when creating an instance of the model (such as using Model.create()).
21
- declare id: CreationOptional<string>;
22
- declare name: string;
23
- declare ownerId: string;
24
- declare isArchived?: boolean;
25
- declare createdAt: CreationOptional<Date>;
26
- declare updatedAt: CreationOptional<Date>;
27
- }
28
-
29
- FanList.init(
30
- {
31
- id: {
32
- type: DataTypes.BIGINT,
33
- primaryKey: true,
34
- allowNull: false,
35
- defaultValue: sequelize.fn("next_id"),
36
- },
37
- ownerId: {
38
- type: DataTypes.BIGINT,
39
- field: "owner_id",
40
- },
41
- name: {
42
- type: DataTypes.STRING,
43
- field: "name",
44
- },
45
- isArchived: {
46
- type: DataTypes.BOOLEAN,
47
- field: "is_archived",
48
- defaultValue: false,
49
- },
50
- createdAt: DataTypes.DATE,
51
- updatedAt: DataTypes.DATE,
52
- },
53
- { tableName: "fan_lists", sequelize }
54
- );
55
-
56
- /*
57
- ====================================================================
58
- Class functions
59
- ====================================================================
60
- */
61
-
62
- FanList.hasMany(ListMember, { foreignKey: "fan_list_id" });
63
- ListMember.hasOne(FanList, { foreignKey: "id", sourceKey: "fanListId" });
64
-
65
- FanList.hasOne(PhoneOwner, { foreignKey: "id", sourceKey: "ownerId" });
66
- PhoneOwner.hasMany(FanList, { foreignKey: "owner_id" });
67
-
68
- export default FanList;