nc-db-new 1.2.2

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 (77) hide show
  1. package/README.md +2 -0
  2. package/dist/config/index.d.ts +3 -0
  3. package/dist/config/index.js +30 -0
  4. package/dist/config/index.js.map +1 -0
  5. package/dist/database/connections.d.ts +3 -0
  6. package/dist/database/connections.js +21 -0
  7. package/dist/database/connections.js.map +1 -0
  8. package/dist/database/fakeData/index.d.ts +49 -0
  9. package/dist/database/fakeData/index.js +155 -0
  10. package/dist/database/fakeData/index.js.map +1 -0
  11. package/dist/database/index.d.ts +5 -0
  12. package/dist/database/index.js +63 -0
  13. package/dist/database/index.js.map +1 -0
  14. package/dist/database/models/Content.d.ts +3 -0
  15. package/dist/database/models/Content.js +64 -0
  16. package/dist/database/models/Content.js.map +1 -0
  17. package/dist/database/models/ContentReport.d.ts +3 -0
  18. package/dist/database/models/ContentReport.js +71 -0
  19. package/dist/database/models/ContentReport.js.map +1 -0
  20. package/dist/database/models/Payout.d.ts +3 -0
  21. package/dist/database/models/Payout.js +39 -0
  22. package/dist/database/models/Payout.js.map +1 -0
  23. package/dist/database/models/PayoutStatus.d.ts +3 -0
  24. package/dist/database/models/PayoutStatus.js +23 -0
  25. package/dist/database/models/PayoutStatus.js.map +1 -0
  26. package/dist/database/models/Report.d.ts +3 -0
  27. package/dist/database/models/Report.js +43 -0
  28. package/dist/database/models/Report.js.map +1 -0
  29. package/dist/database/models/Settings.d.ts +3 -0
  30. package/dist/database/models/Settings.js +25 -0
  31. package/dist/database/models/Settings.js.map +1 -0
  32. package/dist/database/models/Transactions.d.ts +3 -0
  33. package/dist/database/models/Transactions.js +48 -0
  34. package/dist/database/models/Transactions.js.map +1 -0
  35. package/dist/database/models/User.d.ts +3 -0
  36. package/dist/database/models/User.js +65 -0
  37. package/dist/database/models/User.js.map +1 -0
  38. package/dist/database/models/UserRole.d.ts +3 -0
  39. package/dist/database/models/UserRole.js +23 -0
  40. package/dist/database/models/UserRole.js.map +1 -0
  41. package/dist/database/models/UserStatus.d.ts +3 -0
  42. package/dist/database/models/UserStatus.js +23 -0
  43. package/dist/database/models/UserStatus.js.map +1 -0
  44. package/dist/database/models/Watches.d.ts +3 -0
  45. package/dist/database/models/Watches.js +40 -0
  46. package/dist/database/models/Watches.js.map +1 -0
  47. package/dist/database/models/index.d.ts +11 -0
  48. package/dist/database/models/index.js +29 -0
  49. package/dist/database/models/index.js.map +1 -0
  50. package/dist/index.d.ts +5 -0
  51. package/dist/index.js +33 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/interfaces/index.d.ts +228 -0
  54. package/dist/interfaces/index.js +3 -0
  55. package/dist/interfaces/index.js.map +1 -0
  56. package/dist/migration.d.ts +4 -0
  57. package/dist/migration.js +17 -0
  58. package/dist/migration.js.map +1 -0
  59. package/dist/migrations/20220726090948-insert-into-roles-table.d.ts +4 -0
  60. package/dist/migrations/20220726090948-insert-into-roles-table.js +22 -0
  61. package/dist/migrations/20220726090948-insert-into-roles-table.js.map +1 -0
  62. package/dist/migrations/20220726091025-insert-into-settings-table.d.ts +4 -0
  63. package/dist/migrations/20220726091025-insert-into-settings-table.js +22 -0
  64. package/dist/migrations/20220726091025-insert-into-settings-table.js.map +1 -0
  65. package/dist/migrations/20220726091053-insert-into-status-table.d.ts +4 -0
  66. package/dist/migrations/20220726091053-insert-into-status-table.js +22 -0
  67. package/dist/migrations/20220726091053-insert-into-status-table.js.map +1 -0
  68. package/dist/migrations/20220804110541-insert-into-users-table.d.ts +4 -0
  69. package/dist/migrations/20220804110541-insert-into-users-table.js +74 -0
  70. package/dist/migrations/20220804110541-insert-into-users-table.js.map +1 -0
  71. package/dist/migrations/20220907025503-insert-into-payout_statuses-table.d.ts +4 -0
  72. package/dist/migrations/20220907025503-insert-into-payout_statuses-table.js +22 -0
  73. package/dist/migrations/20220907025503-insert-into-payout_statuses-table.js.map +1 -0
  74. package/dist/utils/index.d.ts +6 -0
  75. package/dist/utils/index.js +91 -0
  76. package/dist/utils/index.js.map +1 -0
  77. package/package.json +48 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Report.js","sourceRoot":"","sources":["../../../src/database/models/Report.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AACtC,iEAAuC;AAGvC,MAAM,MAAM,GAAG,qBAAS,CAAC,MAAM,CAC7B,SAAS,EACT;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,IAAI;KACb;IACD,WAAW,EAAE;QACX,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,SAAS,EAAE,KAAK;KACjB;IACD,qBAAqB,EAAE;QACrB,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,2BAA2B,EAAE;QAC3B,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,SAAS,EAAE,KAAK;KACjB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ISettings } from '../../interfaces';
2
+ declare const Settings: import("sequelize").ModelCtor<ISettings>;
3
+ export default Settings;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const connections_1 = __importDefault(require("../connections"));
8
+ const Settings = connections_1.default.define('settings', {
9
+ id: {
10
+ type: sequelize_1.DataTypes.INTEGER,
11
+ autoIncrement: true,
12
+ primaryKey: true,
13
+ },
14
+ name: {
15
+ type: sequelize_1.DataTypes.STRING,
16
+ },
17
+ value: {
18
+ type: sequelize_1.DataTypes.JSON,
19
+ defaultValue: '{}',
20
+ },
21
+ }, {
22
+ paranoid: true,
23
+ });
24
+ exports.default = Settings;
25
+ //# sourceMappingURL=Settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../../src/database/models/Settings.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AACtC,iEAAuC;AAGvC,MAAM,QAAQ,GAAG,qBAAS,CAAC,MAAM,CAC/B,UAAU,EACV;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,IAAI;KACjB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,YAAY,EAAE,IAAI;KACnB;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ITransactions } from '../../interfaces';
2
+ declare const Transactions: import("sequelize").ModelCtor<ITransactions>;
3
+ export default Transactions;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const connections_1 = __importDefault(require("../connections"));
8
+ const Transactions = connections_1.default.define('transactions', {
9
+ id: {
10
+ type: sequelize_1.DataTypes.INTEGER,
11
+ primaryKey: true,
12
+ autoIncrement: true,
13
+ },
14
+ contentId: {
15
+ type: sequelize_1.DataTypes.STRING,
16
+ },
17
+ prevNextUpAccRevenue: {
18
+ type: sequelize_1.DataTypes.DECIMAL,
19
+ },
20
+ nextUpAccRevenue: {
21
+ type: sequelize_1.DataTypes.DECIMAL,
22
+ },
23
+ prevOwedAccRevenue: {
24
+ type: sequelize_1.DataTypes.DECIMAL,
25
+ },
26
+ owedAccRevenue: {
27
+ type: sequelize_1.DataTypes.DECIMAL,
28
+ },
29
+ prevRecoveredCosts: {
30
+ type: sequelize_1.DataTypes.DECIMAL,
31
+ },
32
+ recoveredCosts: {
33
+ type: sequelize_1.DataTypes.DECIMAL,
34
+ },
35
+ contentReportId: {
36
+ type: sequelize_1.DataTypes.INTEGER,
37
+ },
38
+ revenue: {
39
+ type: sequelize_1.DataTypes.DECIMAL,
40
+ },
41
+ nextUpToOwedSplitPercentage: {
42
+ type: sequelize_1.DataTypes.DECIMAL,
43
+ },
44
+ }, {
45
+ paranoid: true,
46
+ });
47
+ exports.default = Transactions;
48
+ //# sourceMappingURL=Transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transactions.js","sourceRoot":"","sources":["../../../src/database/models/Transactions.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AACtC,iEAAuC;AAGvC,MAAM,YAAY,GAAG,qBAAS,CAAC,MAAM,CACnC,cAAc,EACd;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,2BAA2B,EAAE;QAC3B,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IUser } from '../../interfaces';
2
+ declare const User: import("sequelize").ModelCtor<IUser>;
3
+ export default User;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const connections_1 = __importDefault(require("../connections"));
8
+ const User = connections_1.default.define('users', {
9
+ id: {
10
+ type: sequelize_1.DataTypes.INTEGER,
11
+ primaryKey: true,
12
+ autoIncrement: true,
13
+ },
14
+ name: {
15
+ type: sequelize_1.DataTypes.STRING,
16
+ allowNull: false,
17
+ },
18
+ email: {
19
+ type: sequelize_1.DataTypes.STRING,
20
+ allowNull: false,
21
+ unique: true,
22
+ },
23
+ password: {
24
+ type: sequelize_1.DataTypes.STRING,
25
+ allowNull: false,
26
+ },
27
+ userRoleId: {
28
+ type: sequelize_1.DataTypes.INTEGER,
29
+ allowNull: false,
30
+ },
31
+ userStatusId: {
32
+ type: sequelize_1.DataTypes.INTEGER,
33
+ defaultValue: 1,
34
+ },
35
+ googleId: {
36
+ type: sequelize_1.DataTypes.STRING,
37
+ },
38
+ totalRevenue: {
39
+ type: sequelize_1.DataTypes.DECIMAL,
40
+ allowNull: false,
41
+ },
42
+ paidRevenue: {
43
+ type: sequelize_1.DataTypes.DECIMAL,
44
+ allowNull: false,
45
+ },
46
+ image: {
47
+ type: sequelize_1.DataTypes.STRING,
48
+ },
49
+ rejectionReason: {
50
+ type: sequelize_1.DataTypes.STRING,
51
+ },
52
+ stripeAccount: {
53
+ type: sequelize_1.DataTypes.STRING,
54
+ },
55
+ createdBy: {
56
+ type: sequelize_1.DataTypes.INTEGER,
57
+ },
58
+ updatedBy: {
59
+ type: sequelize_1.DataTypes.INTEGER,
60
+ },
61
+ }, {
62
+ paranoid: true,
63
+ });
64
+ exports.default = User;
65
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/database/models/User.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AACtC,iEAAuC;AAGvC,MAAM,IAAI,GAAG,qBAAS,CAAC,MAAM,CAC3B,OAAO,EACP;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;KACjB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,IAAI;KACb;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;KACjB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,SAAS,EAAE,KAAK;KACjB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,YAAY,EAAE,CAAC;KAChB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,SAAS,EAAE,KAAK;KACjB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,SAAS,EAAE,KAAK;KACjB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAS,CAAC,MAAM;KACvB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IUserRole } from '../../interfaces';
2
+ declare const UserRole: import("sequelize").ModelCtor<IUserRole>;
3
+ export default UserRole;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const connections_1 = __importDefault(require("../connections"));
8
+ const UserRole = connections_1.default.define('user_roles', {
9
+ id: {
10
+ type: sequelize_1.DataTypes.INTEGER,
11
+ primaryKey: true,
12
+ autoIncrement: true,
13
+ },
14
+ name: {
15
+ type: sequelize_1.DataTypes.STRING,
16
+ allowNull: false,
17
+ unique: true,
18
+ },
19
+ }, {
20
+ paranoid: true,
21
+ });
22
+ exports.default = UserRole;
23
+ //# sourceMappingURL=UserRole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserRole.js","sourceRoot":"","sources":["../../../src/database/models/UserRole.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AACtC,iEAAuC;AAGvC,MAAM,QAAQ,GAAG,qBAAS,CAAC,MAAM,CAC/B,YAAY,EACZ;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,IAAI;KACb;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IUserStatus } from '../../interfaces';
2
+ declare const UserStatus: import("sequelize").ModelCtor<IUserStatus>;
3
+ export default UserStatus;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const connections_1 = __importDefault(require("../connections"));
8
+ const UserStatus = connections_1.default.define('user_statuses', {
9
+ id: {
10
+ type: sequelize_1.DataTypes.INTEGER,
11
+ primaryKey: true,
12
+ autoIncrement: true,
13
+ },
14
+ name: {
15
+ type: sequelize_1.DataTypes.STRING,
16
+ allowNull: false,
17
+ unique: true,
18
+ },
19
+ }, {
20
+ paranoid: true,
21
+ });
22
+ exports.default = UserStatus;
23
+ //# sourceMappingURL=UserStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserStatus.js","sourceRoot":"","sources":["../../../src/database/models/UserStatus.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AACtC,iEAAuC;AAGvC,MAAM,UAAU,GAAG,qBAAS,CAAC,MAAM,CACjC,eAAe,EACf;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,IAAI;KACb;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IWatches } from '../../interfaces';
2
+ declare const Watches: import("sequelize").ModelCtor<IWatches>;
3
+ export default Watches;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const connections_1 = __importDefault(require("../connections"));
8
+ const Watches = connections_1.default.define('watches', {
9
+ id: {
10
+ type: sequelize_1.DataTypes.INTEGER,
11
+ primaryKey: true,
12
+ autoIncrement: true,
13
+ },
14
+ streamId: {
15
+ type: sequelize_1.DataTypes.STRING,
16
+ allowNull: false,
17
+ },
18
+ duration: {
19
+ type: sequelize_1.DataTypes.BIGINT,
20
+ allowNull: false,
21
+ },
22
+ contentId: {
23
+ type: sequelize_1.DataTypes.STRING,
24
+ allowNull: false,
25
+ },
26
+ contentReportId: {
27
+ type: sequelize_1.DataTypes.INTEGER,
28
+ allowNull: false,
29
+ },
30
+ createdBy: {
31
+ type: sequelize_1.DataTypes.INTEGER,
32
+ },
33
+ updatedBy: {
34
+ type: sequelize_1.DataTypes.INTEGER,
35
+ },
36
+ }, {
37
+ paranoid: true,
38
+ });
39
+ exports.default = Watches;
40
+ //# sourceMappingURL=Watches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Watches.js","sourceRoot":"","sources":["../../../src/database/models/Watches.ts"],"names":[],"mappings":";;;;;AAAA,yCAAsC;AAEtC,iEAAuC;AAEvC,MAAM,OAAO,GAAG,qBAAS,CAAC,MAAM,CAC9B,SAAS,EACT;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;KACjB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;KACjB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;KACjB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,SAAS,EAAE,KAAK;KACjB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;KACxB;CACF,EACD;IACE,QAAQ,EAAE,IAAI;CACf,CACF,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { default as Settings } from './Settings';
2
+ export { default as Content } from './Content';
3
+ export { default as ContentReport } from './ContentReport';
4
+ export { default as Report } from './Report';
5
+ export { default as UserRole } from './UserRole';
6
+ export { default as User } from './User';
7
+ export { default as Watches } from './Watches';
8
+ export { default as UserStatus } from './UserStatus';
9
+ export { default as Transactions } from './Transactions';
10
+ export { default as Payout } from './Payout';
11
+ export { default as PayoutStatus } from './PayoutStatus';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PayoutStatus = exports.Payout = exports.Transactions = exports.UserStatus = exports.Watches = exports.User = exports.UserRole = exports.Report = exports.ContentReport = exports.Content = exports.Settings = void 0;
7
+ var Settings_1 = require("./Settings");
8
+ Object.defineProperty(exports, "Settings", { enumerable: true, get: function () { return __importDefault(Settings_1).default; } });
9
+ var Content_1 = require("./Content");
10
+ Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return __importDefault(Content_1).default; } });
11
+ var ContentReport_1 = require("./ContentReport");
12
+ Object.defineProperty(exports, "ContentReport", { enumerable: true, get: function () { return __importDefault(ContentReport_1).default; } });
13
+ var Report_1 = require("./Report");
14
+ Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return __importDefault(Report_1).default; } });
15
+ var UserRole_1 = require("./UserRole");
16
+ Object.defineProperty(exports, "UserRole", { enumerable: true, get: function () { return __importDefault(UserRole_1).default; } });
17
+ var User_1 = require("./User");
18
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(User_1).default; } });
19
+ var Watches_1 = require("./Watches");
20
+ Object.defineProperty(exports, "Watches", { enumerable: true, get: function () { return __importDefault(Watches_1).default; } });
21
+ var UserStatus_1 = require("./UserStatus");
22
+ Object.defineProperty(exports, "UserStatus", { enumerable: true, get: function () { return __importDefault(UserStatus_1).default; } });
23
+ var Transactions_1 = require("./Transactions");
24
+ Object.defineProperty(exports, "Transactions", { enumerable: true, get: function () { return __importDefault(Transactions_1).default; } });
25
+ var Payout_1 = require("./Payout");
26
+ Object.defineProperty(exports, "Payout", { enumerable: true, get: function () { return __importDefault(Payout_1).default; } });
27
+ var PayoutStatus_1 = require("./PayoutStatus");
28
+ Object.defineProperty(exports, "PayoutStatus", { enumerable: true, get: function () { return __importDefault(PayoutStatus_1).default; } });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAiD;AAAxC,qHAAA,OAAO,OAAY;AAC5B,qCAA+C;AAAtC,mHAAA,OAAO,OAAW;AAC3B,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AACjC,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,uCAAiD;AAAxC,qHAAA,OAAO,OAAY;AAC5B,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,qCAA+C;AAAtC,mHAAA,OAAO,OAAW;AAC3B,2CAAqD;AAA5C,yHAAA,OAAO,OAAc;AAC9B,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB"}
@@ -0,0 +1,5 @@
1
+ export { sequelize, Settings, Content, ContentReport, Report, UserRole, UserStatus, User, Watches, Transactions, Payout, PayoutStatus, ContentReportWatchesAssociation, ReportContentReportAssociation, } from './database/index';
2
+ export { userRoles, userStatus, settings, users, payoutStatuses, } from './database/fakeData';
3
+ export { IContent, IContentReport, IUserRole, ISettings, IUser, IWatches, IReport, IDatabase, IUserStatus, IVariables, IDashboardSettings, IPayout, IPayoutStatus, ICustomUser, } from './interfaces';
4
+ export { getDashboardSettings, getPlansFromSettings } from './utils';
5
+ export { default as migration } from './migration';
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.migration = exports.getPlansFromSettings = exports.getDashboardSettings = exports.payoutStatuses = exports.users = exports.settings = exports.userStatus = exports.userRoles = exports.ReportContentReportAssociation = exports.ContentReportWatchesAssociation = exports.PayoutStatus = exports.Payout = exports.Transactions = exports.Watches = exports.User = exports.UserStatus = exports.UserRole = exports.Report = exports.ContentReport = exports.Content = exports.Settings = exports.sequelize = void 0;
7
+ var index_1 = require("./database/index");
8
+ Object.defineProperty(exports, "sequelize", { enumerable: true, get: function () { return index_1.sequelize; } });
9
+ Object.defineProperty(exports, "Settings", { enumerable: true, get: function () { return index_1.Settings; } });
10
+ Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return index_1.Content; } });
11
+ Object.defineProperty(exports, "ContentReport", { enumerable: true, get: function () { return index_1.ContentReport; } });
12
+ Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return index_1.Report; } });
13
+ Object.defineProperty(exports, "UserRole", { enumerable: true, get: function () { return index_1.UserRole; } });
14
+ Object.defineProperty(exports, "UserStatus", { enumerable: true, get: function () { return index_1.UserStatus; } });
15
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return index_1.User; } });
16
+ Object.defineProperty(exports, "Watches", { enumerable: true, get: function () { return index_1.Watches; } });
17
+ Object.defineProperty(exports, "Transactions", { enumerable: true, get: function () { return index_1.Transactions; } });
18
+ Object.defineProperty(exports, "Payout", { enumerable: true, get: function () { return index_1.Payout; } });
19
+ Object.defineProperty(exports, "PayoutStatus", { enumerable: true, get: function () { return index_1.PayoutStatus; } });
20
+ Object.defineProperty(exports, "ContentReportWatchesAssociation", { enumerable: true, get: function () { return index_1.ContentReportWatchesAssociation; } });
21
+ Object.defineProperty(exports, "ReportContentReportAssociation", { enumerable: true, get: function () { return index_1.ReportContentReportAssociation; } });
22
+ var fakeData_1 = require("./database/fakeData");
23
+ Object.defineProperty(exports, "userRoles", { enumerable: true, get: function () { return fakeData_1.userRoles; } });
24
+ Object.defineProperty(exports, "userStatus", { enumerable: true, get: function () { return fakeData_1.userStatus; } });
25
+ Object.defineProperty(exports, "settings", { enumerable: true, get: function () { return fakeData_1.settings; } });
26
+ Object.defineProperty(exports, "users", { enumerable: true, get: function () { return fakeData_1.users; } });
27
+ Object.defineProperty(exports, "payoutStatuses", { enumerable: true, get: function () { return fakeData_1.payoutStatuses; } });
28
+ var utils_1 = require("./utils");
29
+ Object.defineProperty(exports, "getDashboardSettings", { enumerable: true, get: function () { return utils_1.getDashboardSettings; } });
30
+ Object.defineProperty(exports, "getPlansFromSettings", { enumerable: true, get: function () { return utils_1.getPlansFromSettings; } });
31
+ var migration_1 = require("./migration");
32
+ Object.defineProperty(exports, "migration", { enumerable: true, get: function () { return __importDefault(migration_1).default; } });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAe0B;AAdxB,kGAAA,SAAS,OAAA;AACT,iGAAA,QAAQ,OAAA;AACR,gGAAA,OAAO,OAAA;AACP,sGAAA,aAAa,OAAA;AACb,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,mGAAA,UAAU,OAAA;AACV,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,qGAAA,YAAY,OAAA;AACZ,wHAAA,+BAA+B,OAAA;AAC/B,uHAAA,8BAA8B,OAAA;AAEhC,gDAM6B;AAL3B,qGAAA,SAAS,OAAA;AACT,sGAAA,UAAU,OAAA;AACV,oGAAA,QAAQ,OAAA;AACR,iGAAA,KAAK,OAAA;AACL,0GAAA,cAAc,OAAA;AAkBhB,iCAAqE;AAA5D,6GAAA,oBAAoB,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AACnD,yCAAmD;AAA1C,uHAAA,OAAO,OAAa"}
@@ -0,0 +1,228 @@
1
+ import Big from 'big.js';
2
+ import { InferAttributes, InferCreationAttributes, Model } from 'sequelize';
3
+ interface IDatabase {
4
+ DATABASE_URL: string;
5
+ ENCRYPTION_SECRET_KEY: string;
6
+ }
7
+ interface IBasicContent {
8
+ type?: string;
9
+ id: string;
10
+ userId?: number;
11
+ title: string;
12
+ publishDate: number;
13
+ permalink: string;
14
+ nextUpAccRevenue: string;
15
+ owedAccRevenue: string;
16
+ launchDate?: string;
17
+ advance?: number;
18
+ feePaid?: number;
19
+ filmingCosts?: number;
20
+ paidToOwedAmount?: number;
21
+ freeToBePaid?: number;
22
+ createdBy: number;
23
+ updatedBy: number;
24
+ runtime: number;
25
+ }
26
+ interface IVLContent extends IBasicContent {
27
+ primaryCategory: {
28
+ title: string;
29
+ };
30
+ }
31
+ interface ISubscription {
32
+ planIdentifier: string;
33
+ offersApplied: [];
34
+ }
35
+ interface IPurchase {
36
+ subscription: ISubscription;
37
+ }
38
+ interface IVLUser {
39
+ email: string[];
40
+ purchases: IPurchase[];
41
+ }
42
+ interface IWatchedStream {
43
+ streamId: string;
44
+ contentId: string;
45
+ duration: number;
46
+ content: IVLContent;
47
+ user?: IVLUser;
48
+ }
49
+ interface IDbWatches extends Pick<IWatchedStream, 'streamId' | 'contentId' | 'duration'> {
50
+ createdBy: number;
51
+ updatedBy: number;
52
+ }
53
+ interface IAccumulatedWatchesDurationPerContent {
54
+ contentId: string;
55
+ watchedSeconds: number;
56
+ watches: IDbWatches[];
57
+ revenue: string | Big;
58
+ reportId?: number;
59
+ createdBy: number;
60
+ updatedBy: number;
61
+ tvodTicketsCount: number;
62
+ tvodSeconds: number;
63
+ title?: string;
64
+ nextupRevenue?: string | Big | null;
65
+ owedRevenue?: string | Big | null;
66
+ beforeExpiryReportDaysPercentage?: string | Big | null;
67
+ beforeExpRevenue?: string | Big | null;
68
+ splittableBeforeExpRevenue?: string | Big | null;
69
+ reimbursementBeforeExpRevenue?: string | Big | null;
70
+ afterExpRevenue?: string | Big | null;
71
+ }
72
+ interface IContent extends Model<InferAttributes<IContent>, InferCreationAttributes<IContent>> {
73
+ id: string;
74
+ userId?: number | null;
75
+ title: string;
76
+ publishDate: number;
77
+ permalink: string;
78
+ nextUpAccRevenue: string;
79
+ owedAccRevenue: string;
80
+ launchDate?: string;
81
+ advance?: string;
82
+ feePaid?: string;
83
+ filmingCosts?: string;
84
+ createdBy: number;
85
+ updatedBy: number;
86
+ runtime: number;
87
+ primaryCategory: string;
88
+ recoveredCosts: string;
89
+ contentReports?: IContentReport[];
90
+ createdAt?: string;
91
+ updatedAt?: string;
92
+ }
93
+ interface IContentReport extends Model<InferAttributes<IContentReport>, InferCreationAttributes<IContentReport>> {
94
+ id?: number;
95
+ contentId: string;
96
+ reportId?: number;
97
+ watchedSeconds: number;
98
+ revenue: string | Big;
99
+ createdBy: number;
100
+ updatedBy: number;
101
+ tvodTicketsCount: number;
102
+ tvodSeconds: number;
103
+ watches?: IWatchedStream[] | IDbWatches[];
104
+ nextupRevenue: string | Big | null;
105
+ owedRevenue: string | Big | null;
106
+ beforeExpiryReportDaysPercentage: string | Big | null;
107
+ beforeExpRevenue: string | Big | null;
108
+ splittableBeforeExpRevenue: string | Big | null;
109
+ reimbursementBeforeExpRevenue: string | null;
110
+ afterExpRevenue: string | Big | null;
111
+ report?: IReport;
112
+ createdAt?: string;
113
+ updatedAt?: string;
114
+ }
115
+ interface IReport extends Model<InferAttributes<IReport>, InferCreationAttributes<IReport>> {
116
+ id?: number;
117
+ watchTimeFrom: string;
118
+ watchTimeTo: string;
119
+ overallWatchedSeconds?: number;
120
+ totalRevenue?: number;
121
+ nextUpToOwedSplitPercentage: string;
122
+ createdBy: number;
123
+ updatedBy: number;
124
+ contentReports?: IAccumulatedWatchesDurationPerContent[];
125
+ createdAt?: string;
126
+ updatedAt?: string;
127
+ }
128
+ interface IUserRole extends Model<InferAttributes<IUserRole>, InferCreationAttributes<IUserRole>> {
129
+ id?: number;
130
+ name: string;
131
+ }
132
+ interface IVariables {
133
+ regularVariables: {
134
+ nextupToOwedSplitPercentage: string;
135
+ systemActivationDate: string;
136
+ fetchMaxCount: string;
137
+ expiredAfterInYears: string;
138
+ viewliftEmail: string;
139
+ viewliftEndpoint: string;
140
+ viewliftWatchesFetchLimit: string;
141
+ calculatorEndpoint: string;
142
+ };
143
+ encryptedVariables: {
144
+ viewliftPassword: string;
145
+ stripeKey: string;
146
+ };
147
+ }
148
+ interface IDashboardSettings {
149
+ nextUpToOwedSplitPercentage: string;
150
+ systemActivationDate: string;
151
+ maxCount: number;
152
+ expiredAfterInYears: number;
153
+ email: string;
154
+ viewliftEndpoint: string;
155
+ limit: number;
156
+ password: string;
157
+ stripeKey: string;
158
+ calculatorEndpoint: string;
159
+ }
160
+ interface ISettings extends Model<InferAttributes<ISettings>, InferCreationAttributes<ISettings>> {
161
+ id?: number;
162
+ name: string;
163
+ value: unknown;
164
+ }
165
+ interface IUser extends Model<InferAttributes<IUser>, InferCreationAttributes<IUser>> {
166
+ id?: number;
167
+ name: string;
168
+ email: string;
169
+ password: string;
170
+ googleId?: string;
171
+ userRoleId: number;
172
+ userStatusId?: number;
173
+ totalRevenue: number | Big | string;
174
+ paidRevenue: number | Big | string;
175
+ image?: string;
176
+ rejectionReason?: string;
177
+ stripeAccount?: string;
178
+ createdBy: number;
179
+ updatedBy?: number;
180
+ createdAt?: string;
181
+ updatedAt?: string;
182
+ }
183
+ declare type ICustomUser = Pick<IUser, 'id' | 'name' | 'email' | 'password' | 'googleId' | 'userRoleId' | 'userStatusId' | 'totalRevenue' | 'paidRevenue' | 'image' | 'rejectionReason' | 'createdBy' | 'updatedBy'>;
184
+ interface IWatches extends Model<InferAttributes<IWatches>, InferCreationAttributes<IWatches>> {
185
+ id?: number;
186
+ streamId: string;
187
+ duration: number;
188
+ contentId: string;
189
+ contentReportId: number;
190
+ createdBy: number;
191
+ updatedBy: number;
192
+ }
193
+ interface IUserStatus extends Model<InferAttributes<IUserStatus>, InferCreationAttributes<IUserStatus>> {
194
+ id?: number;
195
+ name: string;
196
+ }
197
+ interface IPayout extends Model<InferAttributes<IPayout>, InferCreationAttributes<IPayout>> {
198
+ id?: number;
199
+ userId: number;
200
+ payoutStatusId: number;
201
+ amount: number | Big | string;
202
+ rejectionReason?: string;
203
+ createdBy: number;
204
+ updatedBy: number;
205
+ createdAt?: string;
206
+ updatedAt?: string;
207
+ user?: IUser;
208
+ }
209
+ interface IPayoutStatus extends Model<InferAttributes<IPayoutStatus>, InferCreationAttributes<IPayoutStatus>> {
210
+ id?: number;
211
+ name: string;
212
+ }
213
+ interface ITransactions extends Model<InferAttributes<ITransactions>, InferCreationAttributes<ITransactions>> {
214
+ id?: number;
215
+ contentId: string;
216
+ nextUpAccRevenue: number;
217
+ owedAccRevenue: number;
218
+ prevNextUpAccRevenue: number;
219
+ prevOwedAccRevenue: number;
220
+ recoveredCosts: number;
221
+ prevRecoveredCosts: number;
222
+ contentReportId: number;
223
+ revenue: number;
224
+ nextUpToOwedSplitPercentage: number;
225
+ createdAt?: string;
226
+ updatedAt?: string;
227
+ }
228
+ export { IContent, IContentReport, IUserRole, ISettings, IUser, IWatches, IReport, IDatabase, IUserStatus, ITransactions, IVariables, IDashboardSettings, IPayout, IPayoutStatus, ICustomUser, };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { Umzug } from 'umzug';
2
+ declare const umzug: Umzug<import("sequelize/types").QueryInterface>;
3
+ export declare type Migration = typeof umzug._types.migration;
4
+ export default umzug;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const umzug_1 = require("umzug");
4
+ const database_1 = require("./database");
5
+ const umzug = new umzug_1.Umzug({
6
+ migrations: {
7
+ glob: ['migrations/*.js', { cwd: __dirname }],
8
+ },
9
+ context: database_1.sequelize.getQueryInterface(),
10
+ storage: new umzug_1.SequelizeStorage({
11
+ sequelize: database_1.sequelize,
12
+ modelName: 'migration_meta',
13
+ }),
14
+ logger: console,
15
+ });
16
+ exports.default = umzug;
17
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":";;AAAA,iCAAgD;AAChD,yCAAuC;AAEvC,MAAM,KAAK,GAAG,IAAI,aAAK,CAAC;IACtB,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;KAC9C;IACD,OAAO,EAAE,oBAAS,CAAC,iBAAiB,EAAE;IACtC,OAAO,EAAE,IAAI,wBAAgB,CAAC;QAC5B,SAAS,EAAT,oBAAS;QACT,SAAS,EAAE,gBAAgB;KAC5B,CAAC;IACF,MAAM,EAAE,OAAO;CAChB,CAAC,CAAC;AAGH,kBAAe,KAAK,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Migration } from '../migration';
2
+ declare const up: Migration;
3
+ declare const down: Migration;
4
+ export { up, down };