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.
- package/README.md +2 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +30 -0
- package/dist/config/index.js.map +1 -0
- package/dist/database/connections.d.ts +3 -0
- package/dist/database/connections.js +21 -0
- package/dist/database/connections.js.map +1 -0
- package/dist/database/fakeData/index.d.ts +49 -0
- package/dist/database/fakeData/index.js +155 -0
- package/dist/database/fakeData/index.js.map +1 -0
- package/dist/database/index.d.ts +5 -0
- package/dist/database/index.js +63 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/models/Content.d.ts +3 -0
- package/dist/database/models/Content.js +64 -0
- package/dist/database/models/Content.js.map +1 -0
- package/dist/database/models/ContentReport.d.ts +3 -0
- package/dist/database/models/ContentReport.js +71 -0
- package/dist/database/models/ContentReport.js.map +1 -0
- package/dist/database/models/Payout.d.ts +3 -0
- package/dist/database/models/Payout.js +39 -0
- package/dist/database/models/Payout.js.map +1 -0
- package/dist/database/models/PayoutStatus.d.ts +3 -0
- package/dist/database/models/PayoutStatus.js +23 -0
- package/dist/database/models/PayoutStatus.js.map +1 -0
- package/dist/database/models/Report.d.ts +3 -0
- package/dist/database/models/Report.js +43 -0
- package/dist/database/models/Report.js.map +1 -0
- package/dist/database/models/Settings.d.ts +3 -0
- package/dist/database/models/Settings.js +25 -0
- package/dist/database/models/Settings.js.map +1 -0
- package/dist/database/models/Transactions.d.ts +3 -0
- package/dist/database/models/Transactions.js +48 -0
- package/dist/database/models/Transactions.js.map +1 -0
- package/dist/database/models/User.d.ts +3 -0
- package/dist/database/models/User.js +65 -0
- package/dist/database/models/User.js.map +1 -0
- package/dist/database/models/UserRole.d.ts +3 -0
- package/dist/database/models/UserRole.js +23 -0
- package/dist/database/models/UserRole.js.map +1 -0
- package/dist/database/models/UserStatus.d.ts +3 -0
- package/dist/database/models/UserStatus.js +23 -0
- package/dist/database/models/UserStatus.js.map +1 -0
- package/dist/database/models/Watches.d.ts +3 -0
- package/dist/database/models/Watches.js +40 -0
- package/dist/database/models/Watches.js.map +1 -0
- package/dist/database/models/index.d.ts +11 -0
- package/dist/database/models/index.js +29 -0
- package/dist/database/models/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +228 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/migration.d.ts +4 -0
- package/dist/migration.js +17 -0
- package/dist/migration.js.map +1 -0
- package/dist/migrations/20220726090948-insert-into-roles-table.d.ts +4 -0
- package/dist/migrations/20220726090948-insert-into-roles-table.js +22 -0
- package/dist/migrations/20220726090948-insert-into-roles-table.js.map +1 -0
- package/dist/migrations/20220726091025-insert-into-settings-table.d.ts +4 -0
- package/dist/migrations/20220726091025-insert-into-settings-table.js +22 -0
- package/dist/migrations/20220726091025-insert-into-settings-table.js.map +1 -0
- package/dist/migrations/20220726091053-insert-into-status-table.d.ts +4 -0
- package/dist/migrations/20220726091053-insert-into-status-table.js +22 -0
- package/dist/migrations/20220726091053-insert-into-status-table.js.map +1 -0
- package/dist/migrations/20220804110541-insert-into-users-table.d.ts +4 -0
- package/dist/migrations/20220804110541-insert-into-users-table.js +74 -0
- package/dist/migrations/20220804110541-insert-into-users-table.js.map +1 -0
- package/dist/migrations/20220907025503-insert-into-payout_statuses-table.d.ts +4 -0
- package/dist/migrations/20220907025503-insert-into-payout_statuses-table.js +22 -0
- package/dist/migrations/20220907025503-insert-into-payout_statuses-table.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +91 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
const up = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
yield queryInterface.bulkInsert('user_roles', __1.userRoles);
|
|
16
|
+
});
|
|
17
|
+
exports.up = up;
|
|
18
|
+
const down = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
yield queryInterface.bulkDelete('user_roles', { name: __1.userRoles.map((role) => role.name) });
|
|
20
|
+
});
|
|
21
|
+
exports.down = down;
|
|
22
|
+
//# sourceMappingURL=20220726090948-insert-into-roles-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20220726090948-insert-into-roles-table.js","sourceRoot":"","sources":["../../src/migrations/20220726090948-insert-into-roles-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA+B;AAG/B,MAAM,EAAE,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC1D,MAAM,cAAc,CAAC,UAAU,CAAC,YAAY,EAAE,aAAS,CAAC,CAAC;AAC3D,CAAC,CAAA,CAAC;AAMO,gBAAE;AAJX,MAAM,IAAI,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC5D,MAAM,cAAc,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,aAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9F,CAAC,CAAA,CAAC;AAEW,oBAAI"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
const up = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
yield queryInterface.bulkInsert('settings', __1.settings);
|
|
16
|
+
});
|
|
17
|
+
exports.up = up;
|
|
18
|
+
const down = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
yield queryInterface.bulkDelete('settings', { name: __1.settings.map((setting) => setting.name) });
|
|
20
|
+
});
|
|
21
|
+
exports.down = down;
|
|
22
|
+
//# sourceMappingURL=20220726091025-insert-into-settings-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20220726091025-insert-into-settings-table.js","sourceRoot":"","sources":["../../src/migrations/20220726091025-insert-into-settings-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA8B;AAG9B,MAAM,EAAE,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC1D,MAAM,cAAc,CAAC,UAAU,CAAC,UAAU,EAAE,YAAQ,CAAC,CAAC;AACxD,CAAC,CAAA,CAAC;AAMO,gBAAE;AAJX,MAAM,IAAI,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC5D,MAAM,cAAc,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,YAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC,CAAA,CAAC;AAEW,oBAAI"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
const up = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
yield queryInterface.bulkInsert('user_statuses', __1.userStatus);
|
|
16
|
+
});
|
|
17
|
+
exports.up = up;
|
|
18
|
+
const down = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
yield queryInterface.bulkDelete('user_statuses', { name: __1.userStatus.map((user) => user.name) });
|
|
20
|
+
});
|
|
21
|
+
exports.down = down;
|
|
22
|
+
//# sourceMappingURL=20220726091053-insert-into-status-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20220726091053-insert-into-status-table.js","sourceRoot":"","sources":["../../src/migrations/20220726091053-insert-into-status-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAAgC;AAGhC,MAAM,EAAE,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC1D,MAAM,cAAc,CAAC,UAAU,CAAC,eAAe,EAAE,cAAU,CAAC,CAAC;AAC/D,CAAC,CAAA,CAAC;AAMO,gBAAE;AAJX,MAAM,IAAI,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC5D,MAAM,cAAc,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,cAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClG,CAAC,CAAA,CAAC;AAEW,oBAAI"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
const up = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
yield Promise.all([
|
|
16
|
+
queryInterface.removeConstraint('users', 'users_created_by_fkey'),
|
|
17
|
+
queryInterface.removeConstraint('users', 'users_updated_by_fkey'),
|
|
18
|
+
queryInterface.removeConstraint('users', 'users_user_role_id_fkey'),
|
|
19
|
+
queryInterface.removeConstraint('users', 'users_user_status_id_fkey'),
|
|
20
|
+
]);
|
|
21
|
+
yield queryInterface.bulkInsert('users', __1.users);
|
|
22
|
+
yield Promise.all([
|
|
23
|
+
queryInterface.addConstraint('users', {
|
|
24
|
+
fields: ['created_by'],
|
|
25
|
+
type: 'foreign key',
|
|
26
|
+
name: 'users_created_by_fkey',
|
|
27
|
+
references: {
|
|
28
|
+
table: 'users',
|
|
29
|
+
field: 'id',
|
|
30
|
+
},
|
|
31
|
+
onDelete: 'cascade',
|
|
32
|
+
onUpdate: 'cascade',
|
|
33
|
+
}),
|
|
34
|
+
queryInterface.addConstraint('users', {
|
|
35
|
+
fields: ['updated_by'],
|
|
36
|
+
type: 'foreign key',
|
|
37
|
+
name: 'users_updated_by_fkey',
|
|
38
|
+
references: {
|
|
39
|
+
table: 'users',
|
|
40
|
+
field: 'id',
|
|
41
|
+
},
|
|
42
|
+
onDelete: 'cascade',
|
|
43
|
+
onUpdate: 'cascade',
|
|
44
|
+
}),
|
|
45
|
+
queryInterface.addConstraint('users', {
|
|
46
|
+
fields: ['user_role_id'],
|
|
47
|
+
type: 'foreign key',
|
|
48
|
+
name: 'users_user_role_id_fkey',
|
|
49
|
+
references: {
|
|
50
|
+
table: 'user_roles',
|
|
51
|
+
field: 'id',
|
|
52
|
+
},
|
|
53
|
+
onDelete: 'cascade',
|
|
54
|
+
onUpdate: 'cascade',
|
|
55
|
+
}),
|
|
56
|
+
queryInterface.addConstraint('users', {
|
|
57
|
+
fields: ['user_status_id'],
|
|
58
|
+
type: 'foreign key',
|
|
59
|
+
name: 'users_user_status_id_fkey',
|
|
60
|
+
references: {
|
|
61
|
+
table: 'user_statuses',
|
|
62
|
+
field: 'id',
|
|
63
|
+
},
|
|
64
|
+
onDelete: 'cascade',
|
|
65
|
+
onUpdate: 'cascade',
|
|
66
|
+
}),
|
|
67
|
+
]);
|
|
68
|
+
});
|
|
69
|
+
exports.up = up;
|
|
70
|
+
const down = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
yield queryInterface.bulkDelete('users', { name: __1.users.map((user) => user.name) });
|
|
72
|
+
});
|
|
73
|
+
exports.down = down;
|
|
74
|
+
//# sourceMappingURL=20220804110541-insert-into-users-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20220804110541-insert-into-users-table.js","sourceRoot":"","sources":["../../src/migrations/20220804110541-insert-into-users-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA2B;AAG3B,MAAM,EAAE,GAAc,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC1D,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,CAAC;QACjE,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,CAAC;QACjE,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,yBAAyB,CAAC;QACnE,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,2BAA2B,CAAC;KACtE,CAAC,CAAC;IAEH,MAAM,cAAc,CAAC,UAAU,CAAC,OAAO,EAAE,SAAK,CAAC,CAAC;IAEhD,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,cAAc,CAAC,aAAa,CAAC,OAAO,EAAE;YACpC,MAAM,EAAE,CAAC,YAAY,CAAC;YACtB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,uBAAuB;YAC7B,UAAU,EAAE;gBACV,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,IAAI;aACZ;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2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
const up = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
yield queryInterface.bulkInsert('payout_statuses', __1.payoutStatuses);
|
|
16
|
+
});
|
|
17
|
+
exports.up = up;
|
|
18
|
+
const down = ({ context: queryInterface }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
yield queryInterface.bulkDelete('payout_statuses', { name: __1.payoutStatuses.map((status) => status.name) });
|
|
20
|
+
});
|
|
21
|
+
exports.down = down;
|
|
22
|
+
//# sourceMappingURL=20220907025503-insert-into-payout_statuses-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20220907025503-insert-into-payout_statuses-table.js","sourceRoot":"","sources":["../../src/migrations/20220907025503-insert-into-payout_statuses-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAAoC;AAGpC,MAAM,EAAE,GAAa,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IACzD,MAAM,cAAc,CAAC,UAAU,CAAC,iBAAiB,EAAE,kBAAc,CAAC,CAAC;AACrE,CAAC,CAAA,CAAC;AAMO,gBAAE;AAJX,MAAM,IAAI,GAAa,CAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;IAC3D,MAAM,cAAc,CAAC,UAAU,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,kBAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5G,CAAC,CAAA,CAAC;AAEW,oBAAI"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getPlansFromSettings = exports.getDashboardSettings = void 0;
|
|
16
|
+
const crypto_js_1 = require("crypto-js");
|
|
17
|
+
const database_1 = require("../database");
|
|
18
|
+
const config_1 = __importDefault(require("../config"));
|
|
19
|
+
const { ENCRYPTION_SECRET_KEY } = config_1.default;
|
|
20
|
+
const getDashboardSettings = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
var _a;
|
|
22
|
+
const settings = (_a = (yield database_1.Settings.findOne({ where: { name: 'variables' } }))) === null || _a === void 0 ? void 0 : _a.value;
|
|
23
|
+
const regularVariables = settings === null || settings === void 0 ? void 0 : settings.regularVariables;
|
|
24
|
+
const encryptedVariables = settings === null || settings === void 0 ? void 0 : settings.encryptedVariables;
|
|
25
|
+
// ? SPLIT_PERCENTAGE
|
|
26
|
+
const nextUpToOwedSplitPercentage = regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.nextupToOwedSplitPercentage;
|
|
27
|
+
if (!nextUpToOwedSplitPercentage)
|
|
28
|
+
throw new Error('nextUpToOwedSplitPercentage not found');
|
|
29
|
+
// ? SYSTEM_ACTIVATION_DATE
|
|
30
|
+
const systemActivationDate = regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.systemActivationDate;
|
|
31
|
+
if (!systemActivationDate)
|
|
32
|
+
throw new Error('systemActivatingDate not found');
|
|
33
|
+
// ? FETCH_MAX_COUNT
|
|
34
|
+
const maxCount = Number(regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.fetchMaxCount);
|
|
35
|
+
if (!maxCount)
|
|
36
|
+
throw new Error('fetchMaxCount not found');
|
|
37
|
+
// ? EXPIRED_AFTER_IN_YEARS
|
|
38
|
+
const expiredAfterInYears = Number(regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.expiredAfterInYears);
|
|
39
|
+
if (!expiredAfterInYears)
|
|
40
|
+
throw new Error('expiredAfterInYears not found');
|
|
41
|
+
// ? VIEWLIFT_EMAIL
|
|
42
|
+
const email = regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.viewliftEmail;
|
|
43
|
+
if (!email)
|
|
44
|
+
throw new Error('viewLiftEmail not found');
|
|
45
|
+
// ? VIEWLIFT_ENDPOINT
|
|
46
|
+
const viewliftEndpoint = regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.viewliftEndpoint;
|
|
47
|
+
if (!viewliftEndpoint)
|
|
48
|
+
throw new Error('viewliftEndpoint not found');
|
|
49
|
+
// ? VIEWLIFT_WATCHES_FETCH_LIMIT
|
|
50
|
+
const limit = Number(regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.viewliftWatchesFetchLimit);
|
|
51
|
+
if (!limit)
|
|
52
|
+
throw new Error('viewLiftWatchesFetchLimit not found');
|
|
53
|
+
// ? VIEWLIFT_EMAIL
|
|
54
|
+
const calculatorEndpoint = regularVariables === null || regularVariables === void 0 ? void 0 : regularVariables.calculatorEndpoint;
|
|
55
|
+
if (!calculatorEndpoint)
|
|
56
|
+
throw new Error('calculatorEndpoint not found');
|
|
57
|
+
let password = encryptedVariables === null || encryptedVariables === void 0 ? void 0 : encryptedVariables.viewliftPassword;
|
|
58
|
+
if (!password)
|
|
59
|
+
throw new Error('viewLiftPassword not found');
|
|
60
|
+
// ? VIEWLIFT_PASSWORD
|
|
61
|
+
password = crypto_js_1.AES
|
|
62
|
+
.decrypt(password, ENCRYPTION_SECRET_KEY)
|
|
63
|
+
.toString(crypto_js_1.enc.Utf8);
|
|
64
|
+
let stripeKey = encryptedVariables === null || encryptedVariables === void 0 ? void 0 : encryptedVariables.stripeKey;
|
|
65
|
+
if (!stripeKey)
|
|
66
|
+
throw new Error('stripeKey not found');
|
|
67
|
+
// ? stripeKey
|
|
68
|
+
stripeKey = crypto_js_1.AES
|
|
69
|
+
.decrypt(stripeKey, ENCRYPTION_SECRET_KEY)
|
|
70
|
+
.toString(crypto_js_1.enc.Utf8);
|
|
71
|
+
return {
|
|
72
|
+
nextUpToOwedSplitPercentage,
|
|
73
|
+
systemActivationDate,
|
|
74
|
+
viewliftEndpoint,
|
|
75
|
+
email,
|
|
76
|
+
password,
|
|
77
|
+
maxCount,
|
|
78
|
+
expiredAfterInYears,
|
|
79
|
+
limit,
|
|
80
|
+
stripeKey,
|
|
81
|
+
calculatorEndpoint,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
exports.getDashboardSettings = getDashboardSettings;
|
|
85
|
+
const getPlansFromSettings = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
var _b;
|
|
87
|
+
const plans = (_b = (yield database_1.Settings.findOne({ where: { name: 'plans' } }))) === null || _b === void 0 ? void 0 : _b.value;
|
|
88
|
+
return plans;
|
|
89
|
+
});
|
|
90
|
+
exports.getPlansFromSettings = getPlansFromSettings;
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAAqC;AACrC,0CAAuC;AAEvC,uDAA+B;AAE/B,MAAM,EAAE,qBAAqB,EAAE,GAAG,gBAAM,CAAC;AAEzC,MAAM,oBAAoB,GAAG,GAAsC,EAAE;;IACnE,MAAM,QAAQ,GAAG,MAAA,CAAC,MAAM,mBAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,0CAAE,KAAmB,CAAC;IACjG,MAAM,gBAAgB,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,gBAAgB,CAAC;IACpD,MAAM,kBAAkB,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,kBAAkB,CAAC;IAExD,qBAAqB;IACrB,MAAM,2BAA2B,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,2BAA2B,CAAC;IAClF,IAAI,CAAC,2BAA2B;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3F,2BAA2B;IAC3B,MAAM,oBAAoB,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,oBAAoB,CAAC;IACpE,IAAI,CAAC,oBAAoB;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC7E,oBAAoB;IACpB,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,aAAa,CAAC,CAAC;IACzD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CA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,IAAI,CAAC,CAAC;IAEtB,IAAI,SAAS,GAAG,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,SAAS,CAAC;IAC9C,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACvD,cAAc;IAEd,SAAS,GAAG,eAAG;SACZ,OAAO,CAAC,SAAS,EAAE,qBAAqB,CAAC;SACzC,QAAQ,CAAC,eAAG,CAAC,IAAI,CAAC,CAAC;IAEtB,OAAO;QACL,2BAA2B;QAC3B,oBAAoB;QACpB,gBAAgB;QAChB,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,mBAAmB;QACnB,KAAK;QACL,SAAS;QACT,kBAAkB;KACnB,CAAC;AACJ,CAAC,CAAA,CAAC;AAQO,oDAAoB;AAN7B,MAAM,oBAAoB,GAAG,GAA6C,EAAE;;IAC1E,MAAM,KAAK,GAAG,MAAA,CAAC,MAAM,mBAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,0CAAE,KAAkC,CAAC;IAEzG,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC;AAE6B,oDAAoB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nc-db-new",
|
|
3
|
+
"version": "1.2.02",
|
|
4
|
+
"description": "Database models for NextUp Comedy Website",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p ."
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/NextUp-comedy/db-models-nc.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"NextUp Comedy",
|
|
19
|
+
"models",
|
|
20
|
+
"database"
|
|
21
|
+
],
|
|
22
|
+
"author": "Zaher, Ibrahim, Rand, Ayman, and Nujood",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/NextUp-comedy/db-models-nc/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/NextUp-comedy/db-models-nc#readme",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@types/big.js": "^6.1.5",
|
|
30
|
+
"crypto-js": "^4.1.1",
|
|
31
|
+
"dotenv": "^16.0.1",
|
|
32
|
+
"joi": "^17.6.0",
|
|
33
|
+
"pg": "^8.7.3",
|
|
34
|
+
"sequelize": "^6.29.1",
|
|
35
|
+
"umzug": "^3.2.1"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/crypto-js": "^4.1.1",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
41
|
+
"eslint": "^8.21.0",
|
|
42
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
43
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
44
|
+
"eslint-import-resolver-typescript": "^3.4.0",
|
|
45
|
+
"eslint-plugin-import": "^2.26.0",
|
|
46
|
+
"typescript": "^4.7.4"
|
|
47
|
+
}
|
|
48
|
+
}
|