@thescaffold/ntx-apps-bridge 0.2.21 → 0.2.31
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/api/license/dto/create-license.dto.d.ts +30 -4
- package/api/license/dto/create-license.dto.js +128 -13
- package/api/license/dto/create-license.dto.js.map +1 -1
- package/api/license/dto/update-license.dto.d.ts +2 -7
- package/api/license/dto/update-license.dto.js +2 -43
- package/api/license/dto/update-license.dto.js.map +1 -1
- package/api/license/entities/license.entity.d.ts +9 -2
- package/api/license/entities/license.entity.js +37 -12
- package/api/license/entities/license.entity.js.map +1 -1
- package/api/license/license.controller.d.ts +43 -5
- package/api/license/license.controller.js +141 -5
- package/api/license/license.controller.js.map +1 -1
- package/api/license/license.module.js +14 -2
- package/api/license/license.module.js.map +1 -1
- package/api/license/license.service.d.ts +2 -2
- package/api/license/license.service.js +2 -4
- package/api/license/license.service.js.map +1 -1
- package/api/license-type/entities/license-type.entity.js +7 -8
- package/api/license-type/entities/license-type.entity.js.map +1 -1
- package/api/license-type/license-type.controller.d.ts +6 -2
- package/api/license-type/license-type.controller.js +2 -2
- package/api/license-type/license-type.controller.js.map +1 -1
- package/api/plan-type/dto/create-plan-type.dto.d.ts +1 -1
- package/api/plan-type/dto/create-plan-type.dto.js +1 -1
- package/api/plan-type/dto/create-plan-type.dto.js.map +1 -1
- package/api/plan-type/dto/update-plan-type.dto.d.ts +1 -1
- package/api/plan-type/dto/update-plan-type.dto.js +1 -1
- package/api/plan-type/dto/update-plan-type.dto.js.map +1 -1
- package/api/plan-type/entities/plan-type.entity.d.ts +3 -5
- package/api/plan-type/entities/plan-type.entity.js +13 -19
- package/api/plan-type/entities/plan-type.entity.js.map +1 -1
- package/api/plan-type/plan-type.controller.d.ts +2 -2
- package/api/plan-type/plan-type.controller.js +1 -3
- package/api/plan-type/plan-type.controller.js.map +1 -1
- package/api/plan-type/plan-type.service.d.ts +2 -2
- package/api/plan-type/plan-type.service.js +2 -2
- package/api/plan-type/plan-type.service.js.map +1 -1
- package/api/preference/dto/create-preference.dto.d.ts +3 -3
- package/api/preference/dto/create-preference.dto.js +3 -3
- package/api/preference/dto/create-preference.dto.js.map +1 -1
- package/api/preference/dto/update-preference.dto.d.ts +3 -3
- package/api/preference/dto/update-preference.dto.js +3 -3
- package/api/preference/dto/update-preference.dto.js.map +1 -1
- package/api/preference/entities/preference.entity.d.ts +6 -6
- package/api/preference/entities/preference.entity.js +12 -12
- package/api/preference/entities/preference.entity.js.map +1 -1
- package/api/preference/preference.controller.d.ts +4 -4
- package/api/preference/preference.controller.js +2 -2
- package/api/preference/preference.controller.js.map +1 -1
- package/api/preference/preference.service.d.ts +5 -5
- package/api/preference/preference.service.js +6 -6
- package/api/preference/preference.service.js.map +1 -1
- package/api/webhook/dto/create-webhook.dto.d.ts +1 -1
- package/api/webhook/dto/create-webhook.dto.js +1 -1
- package/api/webhook/dto/create-webhook.dto.js.map +1 -1
- package/api/webhook/dto/update-webhook.dto.d.ts +1 -1
- package/api/webhook/dto/update-webhook.dto.js +1 -1
- package/api/webhook/dto/update-webhook.dto.js.map +1 -1
- package/api/webhook/entities/webhook.entity.d.ts +3 -3
- package/api/webhook/entities/webhook.entity.js +10 -10
- package/api/webhook/entities/webhook.entity.js.map +1 -1
- package/api/webhook/webhook.controller.d.ts +2 -2
- package/api/webhook/webhook.controller.js +2 -2
- package/api/webhook/webhook.controller.js.map +1 -1
- package/api/webhook/webhook.service.d.ts +2 -2
- package/api/webhook/webhook.service.js +2 -2
- package/api/webhook/webhook.service.js.map +1 -1
- package/api/webhook-log/entities/webhook-log.entity.js +6 -6
- package/api/webhook-log/entities/webhook-log.entity.js.map +1 -1
- package/app.config.d.ts +5 -10
- package/app.config.js +13 -21
- package/app.config.js.map +1 -1
- package/app.controller.d.ts +1 -3
- package/app.controller.js +18 -30
- package/app.controller.js.map +1 -1
- package/app.module.js +0 -30
- package/app.module.js.map +1 -1
- package/index.d.ts +2 -6
- package/index.js +0 -10
- package/index.js.map +1 -1
- package/migrations/1760356231653-BridgeLicense.js +29 -22
- package/migrations/1760356231653-BridgeLicense.js.map +1 -1
- package/migrations/1760356231723-BridgeLicenseType.js +35 -29
- package/migrations/1760356231723-BridgeLicenseType.js.map +1 -1
- package/migrations/1760356231972-BridgePlanType.js +31 -31
- package/migrations/1760356231972-BridgePlanType.js.map +1 -1
- package/migrations/1760356232047-BridgePreference.js +18 -17
- package/migrations/1760356232047-BridgePreference.js.map +1 -1
- package/migrations/1760356232265-BridgeWebhook.js +16 -16
- package/migrations/1760356232265-BridgeWebhook.js.map +1 -1
- package/migrations/1760356232333-BridgeWebhookLog.js +14 -13
- package/migrations/1760356232333-BridgeWebhookLog.js.map +1 -1
- package/migrations/index.d.ts +2 -2
- package/migrations/index.js +0 -12
- package/migrations/index.js.map +1 -1
- package/package.json +42 -13
- package/pkg/index.d.ts +1 -0
- package/{api/user → pkg}/index.js +1 -5
- package/pkg/index.js.map +1 -0
- package/pkg/utils/functions.d.ts +2 -0
- package/pkg/utils/functions.js +15 -0
- package/pkg/utils/functions.js.map +1 -0
- package/pkg/utils/index.d.ts +1 -0
- package/{api/server → pkg/utils}/index.js +1 -5
- package/pkg/utils/index.js.map +1 -0
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/api/attribute/attribute.controller.d.ts +0 -24
- package/api/attribute/attribute.controller.js +0 -43
- package/api/attribute/attribute.controller.js.map +0 -1
- package/api/attribute/attribute.module.d.ts +0 -2
- package/api/attribute/attribute.module.js +0 -27
- package/api/attribute/attribute.module.js.map +0 -1
- package/api/attribute/attribute.service.d.ts +0 -21
- package/api/attribute/attribute.service.js +0 -85
- package/api/attribute/attribute.service.js.map +0 -1
- package/api/attribute/dto/create-attribute.dto.d.ts +0 -8
- package/api/attribute/dto/create-attribute.dto.js +0 -48
- package/api/attribute/dto/create-attribute.dto.js.map +0 -1
- package/api/attribute/dto/update-attribute.dto.d.ts +0 -8
- package/api/attribute/dto/update-attribute.dto.js +0 -49
- package/api/attribute/dto/update-attribute.dto.js.map +0 -1
- package/api/attribute/entities/attribute.entity.d.ts +0 -12
- package/api/attribute/entities/attribute.entity.js +0 -62
- package/api/attribute/entities/attribute.entity.js.map +0 -1
- package/api/attribute/index.d.ts +0 -6
- package/api/attribute/index.js +0 -23
- package/api/attribute/index.js.map +0 -1
- package/api/datacenter/datacenter.controller.d.ts +0 -68
- package/api/datacenter/datacenter.controller.js +0 -146
- package/api/datacenter/datacenter.controller.js.map +0 -1
- package/api/datacenter/datacenter.module.d.ts +0 -2
- package/api/datacenter/datacenter.module.js +0 -40
- package/api/datacenter/datacenter.module.js.map +0 -1
- package/api/datacenter/datacenter.service.d.ts +0 -17
- package/api/datacenter/datacenter.service.js +0 -54
- package/api/datacenter/datacenter.service.js.map +0 -1
- package/api/datacenter/dto/create-datacenter.dto.d.ts +0 -33
- package/api/datacenter/dto/create-datacenter.dto.js +0 -160
- package/api/datacenter/dto/create-datacenter.dto.js.map +0 -1
- package/api/datacenter/dto/update-datacenter.dto.d.ts +0 -3
- package/api/datacenter/dto/update-datacenter.dto.js +0 -8
- package/api/datacenter/dto/update-datacenter.dto.js.map +0 -1
- package/api/datacenter/entities/datacenter.entity.d.ts +0 -23
- package/api/datacenter/entities/datacenter.entity.js +0 -96
- package/api/datacenter/entities/datacenter.entity.js.map +0 -1
- package/api/datacenter/index.d.ts +0 -6
- package/api/datacenter/index.js +0 -23
- package/api/datacenter/index.js.map +0 -1
- package/api/plan/dto/create-plan.dto.d.ts +0 -8
- package/api/plan/dto/create-plan.dto.js +0 -49
- package/api/plan/dto/create-plan.dto.js.map +0 -1
- package/api/plan/dto/update-plan.dto.d.ts +0 -8
- package/api/plan/dto/update-plan.dto.js +0 -49
- package/api/plan/dto/update-plan.dto.js.map +0 -1
- package/api/plan/entities/plan.entity.d.ts +0 -11
- package/api/plan/entities/plan.entity.js +0 -57
- package/api/plan/entities/plan.entity.js.map +0 -1
- package/api/plan/index.d.ts +0 -6
- package/api/plan/index.js +0 -23
- package/api/plan/index.js.map +0 -1
- package/api/plan/plan.controller.d.ts +0 -20
- package/api/plan/plan.controller.js +0 -41
- package/api/plan/plan.controller.js.map +0 -1
- package/api/plan/plan.module.d.ts +0 -2
- package/api/plan/plan.module.js +0 -27
- package/api/plan/plan.module.js.map +0 -1
- package/api/plan/plan.service.d.ts +0 -17
- package/api/plan/plan.service.js +0 -50
- package/api/plan/plan.service.js.map +0 -1
- package/api/server/dto/create-server.dto.d.ts +0 -7
- package/api/server/dto/create-server.dto.js +0 -45
- package/api/server/dto/create-server.dto.js.map +0 -1
- package/api/server/dto/update-server.dto.d.ts +0 -7
- package/api/server/dto/update-server.dto.js +0 -48
- package/api/server/dto/update-server.dto.js.map +0 -1
- package/api/server/entities/server.entity.d.ts +0 -10
- package/api/server/entities/server.entity.js +0 -55
- package/api/server/entities/server.entity.js.map +0 -1
- package/api/server/index.d.ts +0 -5
- package/api/server/index.js.map +0 -1
- package/api/server/server.controller.d.ts +0 -23
- package/api/server/server.controller.js +0 -41
- package/api/server/server.controller.js.map +0 -1
- package/api/server/server.module.d.ts +0 -2
- package/api/server/server.module.js +0 -30
- package/api/server/server.module.js.map +0 -1
- package/api/server/server.service.d.ts +0 -17
- package/api/server/server.service.js +0 -48
- package/api/server/server.service.js.map +0 -1
- package/api/user/dto/create-user.dto.d.ts +0 -7
- package/api/user/dto/create-user.dto.js +0 -40
- package/api/user/dto/create-user.dto.js.map +0 -1
- package/api/user/dto/update-user.dto.d.ts +0 -7
- package/api/user/dto/update-user.dto.js +0 -40
- package/api/user/dto/update-user.dto.js.map +0 -1
- package/api/user/entities/user.entity.d.ts +0 -16
- package/api/user/entities/user.entity.js +0 -81
- package/api/user/entities/user.entity.js.map +0 -1
- package/api/user/index.d.ts +0 -5
- package/api/user/index.js.map +0 -1
- package/api/user/user.controller.d.ts +0 -22
- package/api/user/user.controller.js +0 -40
- package/api/user/user.controller.js.map +0 -1
- package/api/user/user.module.d.ts +0 -2
- package/api/user/user.module.js +0 -27
- package/api/user/user.module.js.map +0 -1
- package/api/user/user.service.d.ts +0 -17
- package/api/user/user.service.js +0 -48
- package/api/user/user.service.js.map +0 -1
- package/migrations/1760356231511-BridgeAttribute.d.ts +0 -5
- package/migrations/1760356231511-BridgeAttribute.js +0 -33
- package/migrations/1760356231511-BridgeAttribute.js.map +0 -1
- package/migrations/1760356231581-BridgeDatacenter.d.ts +0 -5
- package/migrations/1760356231581-BridgeDatacenter.js +0 -36
- package/migrations/1760356231581-BridgeDatacenter.js.map +0 -1
- package/migrations/1760356231827-BridgePlan.d.ts +0 -5
- package/migrations/1760356231827-BridgePlan.js +0 -30
- package/migrations/1760356231827-BridgePlan.js.map +0 -1
- package/migrations/1760356232120-BridgeServer.d.ts +0 -5
- package/migrations/1760356232120-BridgeServer.js +0 -33
- package/migrations/1760356232120-BridgeServer.js.map +0 -1
- package/migrations/1760356232195-BridgeUser.d.ts +0 -5
- package/migrations/1760356232195-BridgeUser.js +0 -34
- package/migrations/1760356232195-BridgeUser.js.map +0 -1
- package/migrations/1760357588527-BridgeLicenseTypeData.d.ts +0 -5
- package/migrations/1760357588527-BridgeLicenseTypeData.js +0 -262
- package/migrations/1760357588527-BridgeLicenseTypeData.js.map +0 -1
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { PeriodType } from '@thescaffold/ntx-core';
|
|
2
|
+
import { LicensePreferenceType } from '../../../app.config';
|
|
3
|
+
export declare class LicenseTypeDto {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class PreferenceDto {
|
|
7
|
+
key: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
type: LicensePreferenceType;
|
|
10
|
+
}
|
|
11
|
+
export declare class PlanTypeDto {
|
|
12
|
+
name: string;
|
|
13
|
+
desc?: string;
|
|
14
|
+
detail?: string;
|
|
15
|
+
type?: string;
|
|
16
|
+
currency?: string;
|
|
17
|
+
daily?: number;
|
|
18
|
+
weekly?: number;
|
|
19
|
+
monthly: number;
|
|
20
|
+
yearly?: number;
|
|
21
|
+
flags?: string[];
|
|
22
|
+
}
|
|
23
|
+
export declare class WebhookDto {
|
|
24
|
+
url: string;
|
|
25
|
+
events?: string[];
|
|
26
|
+
}
|
|
2
27
|
export declare class CreateLicenseDto {
|
|
3
|
-
|
|
4
|
-
datacenterId?: string;
|
|
28
|
+
type: LicenseTypeDto;
|
|
5
29
|
periodType?: PeriodType;
|
|
6
|
-
|
|
7
|
-
|
|
30
|
+
preferences?: PreferenceDto[];
|
|
31
|
+
planTypes?: PlanTypeDto[];
|
|
32
|
+
webhooks?: WebhookDto[];
|
|
33
|
+
amount?: number;
|
|
8
34
|
}
|
|
@@ -9,41 +9,156 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CreateLicenseDto = void 0;
|
|
12
|
+
exports.CreateLicenseDto = exports.WebhookDto = exports.PlanTypeDto = exports.PreferenceDto = exports.LicenseTypeDto = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
const ntx_core_1 = require("@thescaffold/ntx-core");
|
|
15
14
|
const class_validator_1 = require("class-validator");
|
|
16
|
-
|
|
15
|
+
const swagger_2 = require("@nestjs/swagger");
|
|
16
|
+
const ntx_core_1 = require("@thescaffold/ntx-core");
|
|
17
|
+
const class_transformer_1 = require("class-transformer");
|
|
18
|
+
const class_validator_2 = require("class-validator");
|
|
19
|
+
const app_config_1 = require("../../../app.config");
|
|
20
|
+
class LicenseTypeDto {
|
|
17
21
|
}
|
|
18
|
-
exports.
|
|
22
|
+
exports.LicenseTypeDto = LicenseTypeDto;
|
|
19
23
|
__decorate([
|
|
20
24
|
(0, class_validator_1.IsUUID)(),
|
|
25
|
+
(0, swagger_2.ApiProperty)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], LicenseTypeDto.prototype, "id", void 0);
|
|
28
|
+
class PreferenceDto {
|
|
29
|
+
}
|
|
30
|
+
exports.PreferenceDto = PreferenceDto;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
(0, swagger_2.ApiProperty)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], PreferenceDto.prototype, "key", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.IsString)(),
|
|
21
38
|
(0, class_validator_1.IsOptional)(),
|
|
22
39
|
(0, swagger_1.ApiPropertyOptional)(),
|
|
23
40
|
__metadata("design:type", String)
|
|
24
|
-
],
|
|
41
|
+
], PreferenceDto.prototype, "value", void 0);
|
|
25
42
|
__decorate([
|
|
26
|
-
(0, class_validator_1.
|
|
43
|
+
(0, class_validator_1.IsEnum)(app_config_1.LicensePreferenceType),
|
|
44
|
+
(0, swagger_2.ApiProperty)(),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], PreferenceDto.prototype, "type", void 0);
|
|
47
|
+
class PlanTypeDto {
|
|
48
|
+
}
|
|
49
|
+
exports.PlanTypeDto = PlanTypeDto;
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsString)(),
|
|
52
|
+
(0, swagger_2.ApiProperty)(),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], PlanTypeDto.prototype, "name", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsString)(),
|
|
27
57
|
(0, class_validator_1.IsOptional)(),
|
|
28
58
|
(0, swagger_1.ApiPropertyOptional)(),
|
|
29
59
|
__metadata("design:type", String)
|
|
30
|
-
],
|
|
60
|
+
], PlanTypeDto.prototype, "desc", void 0);
|
|
31
61
|
__decorate([
|
|
32
|
-
(0, class_validator_1.
|
|
62
|
+
(0, class_validator_1.IsString)(),
|
|
33
63
|
(0, class_validator_1.IsOptional)(),
|
|
34
64
|
(0, swagger_1.ApiPropertyOptional)(),
|
|
35
65
|
__metadata("design:type", String)
|
|
36
|
-
],
|
|
66
|
+
], PlanTypeDto.prototype, "detail", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, class_validator_1.IsString)(),
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], PlanTypeDto.prototype, "type", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, class_validator_1.IsString)(),
|
|
75
|
+
(0, class_validator_1.IsOptional)(),
|
|
76
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], PlanTypeDto.prototype, "currency", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, class_validator_2.IsNumber)(),
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
83
|
+
__metadata("design:type", Number)
|
|
84
|
+
], PlanTypeDto.prototype, "daily", void 0);
|
|
37
85
|
__decorate([
|
|
38
|
-
(0,
|
|
86
|
+
(0, class_validator_2.IsNumber)(),
|
|
39
87
|
(0, class_validator_1.IsOptional)(),
|
|
40
88
|
(0, swagger_1.ApiPropertyOptional)(),
|
|
41
|
-
__metadata("design:type",
|
|
42
|
-
],
|
|
89
|
+
__metadata("design:type", Number)
|
|
90
|
+
], PlanTypeDto.prototype, "weekly", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, class_validator_2.IsNumber)(),
|
|
93
|
+
(0, swagger_2.ApiProperty)(),
|
|
94
|
+
__metadata("design:type", Number)
|
|
95
|
+
], PlanTypeDto.prototype, "monthly", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, class_validator_2.IsNumber)(),
|
|
98
|
+
(0, class_validator_1.IsOptional)(),
|
|
99
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
100
|
+
__metadata("design:type", Number)
|
|
101
|
+
], PlanTypeDto.prototype, "yearly", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
104
|
+
(0, class_validator_1.IsOptional)(),
|
|
105
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
106
|
+
__metadata("design:type", Array)
|
|
107
|
+
], PlanTypeDto.prototype, "flags", void 0);
|
|
108
|
+
class WebhookDto {
|
|
109
|
+
}
|
|
110
|
+
exports.WebhookDto = WebhookDto;
|
|
43
111
|
__decorate([
|
|
44
112
|
(0, class_validator_1.IsString)(),
|
|
113
|
+
(0, swagger_2.ApiProperty)(),
|
|
114
|
+
__metadata("design:type", String)
|
|
115
|
+
], WebhookDto.prototype, "url", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
118
|
+
(0, class_validator_1.IsOptional)(),
|
|
119
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
120
|
+
__metadata("design:type", Array)
|
|
121
|
+
], WebhookDto.prototype, "events", void 0);
|
|
122
|
+
class CreateLicenseDto {
|
|
123
|
+
}
|
|
124
|
+
exports.CreateLicenseDto = CreateLicenseDto;
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, class_validator_2.ValidateNested)(),
|
|
127
|
+
(0, class_transformer_1.Type)(() => LicenseTypeDto),
|
|
128
|
+
(0, swagger_2.ApiProperty)(),
|
|
129
|
+
__metadata("design:type", LicenseTypeDto)
|
|
130
|
+
], CreateLicenseDto.prototype, "type", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, class_validator_1.IsEnum)(ntx_core_1.PeriodType),
|
|
45
133
|
(0, class_validator_1.IsOptional)(),
|
|
46
134
|
(0, swagger_1.ApiPropertyOptional)(),
|
|
47
135
|
__metadata("design:type", String)
|
|
48
|
-
], CreateLicenseDto.prototype, "
|
|
136
|
+
], CreateLicenseDto.prototype, "periodType", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
(0, class_validator_2.ValidateNested)({ each: true }),
|
|
139
|
+
(0, class_transformer_1.Type)(() => PreferenceDto),
|
|
140
|
+
(0, class_validator_1.IsOptional)(),
|
|
141
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
142
|
+
__metadata("design:type", Array)
|
|
143
|
+
], CreateLicenseDto.prototype, "preferences", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
(0, class_validator_2.ValidateNested)({ each: true }),
|
|
146
|
+
(0, class_transformer_1.Type)(() => PlanTypeDto),
|
|
147
|
+
(0, class_validator_1.IsOptional)(),
|
|
148
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
149
|
+
__metadata("design:type", Array)
|
|
150
|
+
], CreateLicenseDto.prototype, "planTypes", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, class_validator_2.ValidateNested)({ each: true }),
|
|
153
|
+
(0, class_transformer_1.Type)(() => WebhookDto),
|
|
154
|
+
(0, class_validator_1.IsOptional)(),
|
|
155
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
156
|
+
__metadata("design:type", Array)
|
|
157
|
+
], CreateLicenseDto.prototype, "webhooks", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, class_validator_2.IsNumber)(),
|
|
160
|
+
(0, class_validator_1.IsOptional)(),
|
|
161
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
162
|
+
__metadata("design:type", Number)
|
|
163
|
+
], CreateLicenseDto.prototype, "amount", void 0);
|
|
49
164
|
//# sourceMappingURL=create-license.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-license.dto.js","sourceRoot":"","sources":["../../../../../../libs/bridge/src/api/license/dto/create-license.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,oDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"create-license.dto.js","sourceRoot":"","sources":["../../../../../../libs/bridge/src/api/license/dto/create-license.dto.ts"],"names":[],"mappings":";;;;;;;;;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6BAAmB,GAAE;;kDACE;AAKxB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAmB,GAAE;;gDACN"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class UpdateLicenseDto {
|
|
3
|
-
typeId?: string;
|
|
4
|
-
datacenterId?: string;
|
|
5
|
-
periodType?: PeriodType;
|
|
6
|
-
meta?: any;
|
|
7
|
-
status?: string;
|
|
1
|
+
import { CreateLicenseDto } from './create-license.dto';
|
|
2
|
+
export declare class UpdateLicenseDto extends CreateLicenseDto {
|
|
8
3
|
}
|
|
@@ -1,49 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.UpdateLicenseDto = void 0;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const class_validator_1 = require("class-validator");
|
|
16
|
-
class UpdateLicenseDto {
|
|
4
|
+
const create_license_dto_1 = require("./create-license.dto");
|
|
5
|
+
class UpdateLicenseDto extends create_license_dto_1.CreateLicenseDto {
|
|
17
6
|
}
|
|
18
7
|
exports.UpdateLicenseDto = UpdateLicenseDto;
|
|
19
|
-
__decorate([
|
|
20
|
-
(0, class_validator_1.IsUUID)(),
|
|
21
|
-
(0, class_validator_1.IsOptional)(),
|
|
22
|
-
(0, swagger_1.ApiPropertyOptional)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], UpdateLicenseDto.prototype, "typeId", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, class_validator_1.IsUUID)(),
|
|
27
|
-
(0, class_validator_1.IsOptional)(),
|
|
28
|
-
(0, swagger_1.ApiPropertyOptional)(),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], UpdateLicenseDto.prototype, "datacenterId", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, class_validator_1.IsEnum)(ntx_core_1.PeriodType),
|
|
33
|
-
(0, class_validator_1.IsOptional)(),
|
|
34
|
-
(0, swagger_1.ApiPropertyOptional)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], UpdateLicenseDto.prototype, "periodType", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, class_validator_1.IsObject)(),
|
|
39
|
-
(0, class_validator_1.IsOptional)(),
|
|
40
|
-
(0, swagger_1.ApiPropertyOptional)(),
|
|
41
|
-
__metadata("design:type", Object)
|
|
42
|
-
], UpdateLicenseDto.prototype, "meta", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, class_validator_1.IsString)(),
|
|
45
|
-
(0, class_validator_1.IsOptional)(),
|
|
46
|
-
(0, swagger_1.ApiPropertyOptional)(),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], UpdateLicenseDto.prototype, "status", void 0);
|
|
49
8
|
//# sourceMappingURL=update-license.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-license.dto.js","sourceRoot":"","sources":["../../../../../../libs/bridge/src/api/license/dto/update-license.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-license.dto.js","sourceRoot":"","sources":["../../../../../../libs/bridge/src/api/license/dto/update-license.dto.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,gBAAiB,SAAQ,qCAAgB;CAAG;AAAzD,4CAAyD"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { BaseEntity, PeriodType } from '@thescaffold/ntx-core';
|
|
2
|
-
import { Datacenter } from '../../datacenter/entities/datacenter.entity';
|
|
3
2
|
import { LicenseType } from '../../license-type/entities/license-type.entity';
|
|
3
|
+
import { PlanType } from '../../plan-type/entities/plan-type.entity';
|
|
4
|
+
import { Preference } from '../../preference/entities/preference.entity';
|
|
5
|
+
import { Webhook } from '../../webhook/entities/webhook.entity';
|
|
4
6
|
export declare class License extends BaseEntity {
|
|
7
|
+
userId: string;
|
|
8
|
+
clientId: string;
|
|
9
|
+
workspaceId: string;
|
|
5
10
|
typeId: string;
|
|
6
11
|
type?: LicenseType;
|
|
7
|
-
datacenter?: Datacenter;
|
|
8
12
|
periodType?: PeriodType;
|
|
9
13
|
token?: string;
|
|
10
14
|
startAt?: Date;
|
|
@@ -12,4 +16,7 @@ export declare class License extends BaseEntity {
|
|
|
12
16
|
expiredAt?: Date;
|
|
13
17
|
meta?: any;
|
|
14
18
|
status?: string;
|
|
19
|
+
preferences?: Preference[];
|
|
20
|
+
planTypes?: PlanType[];
|
|
21
|
+
webhooks?: Webhook[];
|
|
15
22
|
}
|
|
@@ -12,14 +12,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.License = void 0;
|
|
13
13
|
const ntx_core_1 = require("@thescaffold/ntx-core");
|
|
14
14
|
const typeorm_1 = require("typeorm");
|
|
15
|
-
const datacenter_entity_1 = require("../../datacenter/entities/datacenter.entity");
|
|
16
15
|
const license_type_entity_1 = require("../../license-type/entities/license-type.entity");
|
|
16
|
+
const plan_type_entity_1 = require("../../plan-type/entities/plan-type.entity");
|
|
17
|
+
const preference_entity_1 = require("../../preference/entities/preference.entity");
|
|
18
|
+
const webhook_entity_1 = require("../../webhook/entities/webhook.entity");
|
|
17
19
|
let License = class License extends ntx_core_1.BaseEntity {
|
|
18
20
|
};
|
|
19
21
|
exports.License = License;
|
|
20
22
|
__decorate([
|
|
21
23
|
(0, typeorm_1.Index)(),
|
|
22
|
-
(0, typeorm_1.Column)('
|
|
24
|
+
(0, typeorm_1.Column)('uuid', { name: 'userId' }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], License.prototype, "userId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Index)(),
|
|
29
|
+
(0, typeorm_1.Column)('varchar', { name: 'clientId' }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], License.prototype, "clientId", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Index)(),
|
|
34
|
+
(0, typeorm_1.Column)('uuid', { name: 'workspaceId' }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], License.prototype, "workspaceId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Index)(),
|
|
39
|
+
(0, typeorm_1.Column)('uuid', { name: 'typeId' }),
|
|
23
40
|
__metadata("design:type", String)
|
|
24
41
|
], License.prototype, "typeId", void 0);
|
|
25
42
|
__decorate([
|
|
@@ -28,13 +45,9 @@ __decorate([
|
|
|
28
45
|
}),
|
|
29
46
|
__metadata("design:type", license_type_entity_1.LicenseType)
|
|
30
47
|
], License.prototype, "type", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, typeorm_1.OneToOne)((datacenter) => datacenter_entity_1.Datacenter, (datacenter) => datacenter.license),
|
|
33
|
-
__metadata("design:type", datacenter_entity_1.Datacenter)
|
|
34
|
-
], License.prototype, "datacenter", void 0);
|
|
35
48
|
__decorate([
|
|
36
49
|
(0, typeorm_1.Index)(),
|
|
37
|
-
(0, typeorm_1.Column)('varchar', { name: 'periodType',
|
|
50
|
+
(0, typeorm_1.Column)('varchar', { name: 'periodType', nullable: true }),
|
|
38
51
|
__metadata("design:type", String)
|
|
39
52
|
], License.prototype, "periodType", void 0);
|
|
40
53
|
__decorate([
|
|
@@ -50,28 +63,40 @@ __decorate([
|
|
|
50
63
|
], License.prototype, "token", void 0);
|
|
51
64
|
__decorate([
|
|
52
65
|
(0, typeorm_1.Index)(),
|
|
53
|
-
(0, typeorm_1.Column)('
|
|
66
|
+
(0, typeorm_1.Column)('timestamp', { name: 'startAt', nullable: true }),
|
|
54
67
|
__metadata("design:type", Date)
|
|
55
68
|
], License.prototype, "startAt", void 0);
|
|
56
69
|
__decorate([
|
|
57
70
|
(0, typeorm_1.Index)(),
|
|
58
|
-
(0, typeorm_1.Column)('
|
|
71
|
+
(0, typeorm_1.Column)('timestamp', { name: 'renewedAt', nullable: true }),
|
|
59
72
|
__metadata("design:type", Date)
|
|
60
73
|
], License.prototype, "renewedAt", void 0);
|
|
61
74
|
__decorate([
|
|
62
75
|
(0, typeorm_1.Index)(),
|
|
63
|
-
(0, typeorm_1.Column)('
|
|
76
|
+
(0, typeorm_1.Column)('timestamp', { name: 'expiredAt', nullable: true }),
|
|
64
77
|
__metadata("design:type", Date)
|
|
65
78
|
], License.prototype, "expiredAt", void 0);
|
|
66
79
|
__decorate([
|
|
67
|
-
(0, typeorm_1.Column)('
|
|
80
|
+
(0, typeorm_1.Column)('jsonb', { name: 'meta', nullable: true }),
|
|
68
81
|
__metadata("design:type", Object)
|
|
69
82
|
], License.prototype, "meta", void 0);
|
|
70
83
|
__decorate([
|
|
71
84
|
(0, typeorm_1.Index)(),
|
|
72
|
-
(0, typeorm_1.Column)('varchar', { name: 'status', nullable: true
|
|
85
|
+
(0, typeorm_1.Column)('varchar', { name: 'status', nullable: true }),
|
|
73
86
|
__metadata("design:type", String)
|
|
74
87
|
], License.prototype, "status", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.OneToMany)((type) => preference_entity_1.Preference, (preference) => preference.license),
|
|
90
|
+
__metadata("design:type", Array)
|
|
91
|
+
], License.prototype, "preferences", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.OneToMany)((type) => plan_type_entity_1.PlanType, (type) => type.license),
|
|
94
|
+
__metadata("design:type", Array)
|
|
95
|
+
], License.prototype, "planTypes", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.OneToMany)((type) => webhook_entity_1.Webhook, (webhook) => webhook.license),
|
|
98
|
+
__metadata("design:type", Array)
|
|
99
|
+
], License.prototype, "webhooks", void 0);
|
|
75
100
|
exports.License = License = __decorate([
|
|
76
101
|
(0, typeorm_1.Entity)({
|
|
77
102
|
name: 'BridgeLicenses',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.entity.js","sourceRoot":"","sources":["../../../../../../libs/bridge/src/api/license/entities/license.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAK+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"license.entity.js","sourceRoot":"","sources":["../../../../../../libs/bridge/src/api/license/entities/license.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAK+B;AAC/B,qCAAsE;AACtE,yFAA8E;AAC9E,gFAAqE;AACrE,mFAAyE;AACzE,0EAAgE;AAQzD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,qBAAU;CA+DtC,CAAA;AA/DY,0BAAO;AAGlB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;uCACpB;AAIf;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;;yCACvB;AAIjB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;;4CACpB;AAIpB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,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qCACvC;AAIX;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACtC;AAGhB;IADC,IAAA,mBAAS,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,8BAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;4CACzC;AAG3B;IADC,IAAA,mBAAS,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,2BAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;;0CAC/B;AAGvB;IADC,IAAA,mBAAS,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;yCACtC;kBA9DV,OAAO;IANnB,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;YACP,SAAS,EAAE,MAAM;SAClB;KACF,CAAC;GACW,OAAO,CA+DnB"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { LanguageService, MediaService, PeriodType } from '@thescaffold/ntx-core';
|
|
3
|
+
import { LicenseStatusType } from '../../app.config';
|
|
4
|
+
import { PlanTypeService } from '../plan-type';
|
|
5
|
+
import { PreferenceService } from '../preference';
|
|
6
|
+
import { WebhookService } from '../webhook';
|
|
2
7
|
import { CreateLicenseDto } from './dto/create-license.dto';
|
|
3
8
|
import { UpdateLicenseDto } from './dto/update-license.dto';
|
|
4
9
|
import { License } from './entities/license.entity';
|
|
@@ -8,13 +13,46 @@ export declare class LicenseController extends LicenseController_base {
|
|
|
8
13
|
private readonly licenseService;
|
|
9
14
|
protected readonly languageService: LanguageService;
|
|
10
15
|
protected readonly mediaService: MediaService;
|
|
16
|
+
protected readonly configService: ConfigService;
|
|
17
|
+
private readonly preferenceService;
|
|
18
|
+
private readonly planTypeService;
|
|
19
|
+
private readonly webhookService;
|
|
11
20
|
protected name: string;
|
|
12
21
|
protected searchable: any[];
|
|
13
22
|
protected service: LicenseService;
|
|
14
|
-
protected unique: (
|
|
23
|
+
protected unique: (entity: License) => any[];
|
|
15
24
|
protected morphRequest: (entity: License) => License;
|
|
16
|
-
protected morphs: {
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
protected morphs: {
|
|
26
|
+
beforeCreate: (payload: CreateLicenseDto, context: any) => Promise<{
|
|
27
|
+
userId: any;
|
|
28
|
+
clientId: any;
|
|
29
|
+
workspaceId: any;
|
|
30
|
+
typeId: string;
|
|
31
|
+
periodType: PeriodType;
|
|
32
|
+
meta: {
|
|
33
|
+
type: import("./dto/create-license.dto").LicenseTypeDto;
|
|
34
|
+
preferences: import("./dto/create-license.dto").PreferenceDto[];
|
|
35
|
+
planTypes: import("./dto/create-license.dto").PlanTypeDto[];
|
|
36
|
+
webhooks: import("./dto/create-license.dto").WebhookDto[];
|
|
37
|
+
amount: number;
|
|
38
|
+
};
|
|
39
|
+
status: LicenseStatusType;
|
|
40
|
+
}>;
|
|
41
|
+
beforeUpdate: (payload: UpdateLicenseDto, context: any) => Promise<{
|
|
42
|
+
meta: {
|
|
43
|
+
type: import("./dto/create-license.dto").LicenseTypeDto;
|
|
44
|
+
preferences: import("./dto/create-license.dto").PreferenceDto[];
|
|
45
|
+
planTypes: import("./dto/create-license.dto").PlanTypeDto[];
|
|
46
|
+
webhooks: import("./dto/create-license.dto").WebhookDto[];
|
|
47
|
+
amount: number;
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
protected hooks: {
|
|
52
|
+
afterCreate: (entity: License, context: any, payload: any) => Promise<never>;
|
|
53
|
+
afterUpdate: (entity: License, context: any, payload: any) => Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
constructor(licenseService: LicenseService, languageService: LanguageService, mediaService: MediaService, configService: ConfigService, preferenceService: PreferenceService, planTypeService: PlanTypeService, webhookService: WebhookService);
|
|
56
|
+
private process;
|
|
19
57
|
}
|
|
20
58
|
export {};
|
|
@@ -11,24 +11,156 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.LicenseController = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
+
const config_1 = require("@nestjs/config");
|
|
14
15
|
const ntx_core_1 = require("@thescaffold/ntx-core");
|
|
16
|
+
const app_config_1 = require("../../app.config");
|
|
17
|
+
const plan_type_1 = require("../plan-type");
|
|
18
|
+
const preference_1 = require("../preference");
|
|
19
|
+
const webhook_1 = require("../webhook");
|
|
15
20
|
const create_license_dto_1 = require("./dto/create-license.dto");
|
|
16
21
|
const update_license_dto_1 = require("./dto/update-license.dto");
|
|
17
22
|
const license_entity_1 = require("./entities/license.entity");
|
|
18
23
|
const license_service_1 = require("./license.service");
|
|
19
24
|
let LicenseController = class LicenseController extends (0, ntx_core_1.CrudControllerFactory)(create_license_dto_1.CreateLicenseDto, update_license_dto_1.UpdateLicenseDto, license_entity_1.License) {
|
|
20
|
-
constructor(licenseService, languageService, mediaService) {
|
|
25
|
+
constructor(licenseService, languageService, mediaService, configService, preferenceService, planTypeService, webhookService) {
|
|
21
26
|
super();
|
|
22
27
|
this.licenseService = licenseService;
|
|
23
28
|
this.languageService = languageService;
|
|
24
29
|
this.mediaService = mediaService;
|
|
30
|
+
this.configService = configService;
|
|
31
|
+
this.preferenceService = preferenceService;
|
|
32
|
+
this.planTypeService = planTypeService;
|
|
33
|
+
this.webhookService = webhookService;
|
|
25
34
|
this.name = 'license';
|
|
26
35
|
this.searchable = [];
|
|
27
36
|
this.service = this.licenseService;
|
|
28
|
-
this.unique = (
|
|
37
|
+
this.unique = (entity) => [];
|
|
29
38
|
this.morphRequest = (entity) => entity;
|
|
30
|
-
this.morphs = {
|
|
31
|
-
|
|
39
|
+
this.morphs = {
|
|
40
|
+
[ntx_core_1.CrudActionType.beforeCreate]: async (payload, context) => {
|
|
41
|
+
const { preference } = context;
|
|
42
|
+
const { user, client, workspace } = context;
|
|
43
|
+
const { type, periodType, preferences, planTypes, webhooks, amount } = payload;
|
|
44
|
+
return {
|
|
45
|
+
userId: user.id,
|
|
46
|
+
clientId: client.id,
|
|
47
|
+
workspaceId: workspace.id,
|
|
48
|
+
typeId: type.id,
|
|
49
|
+
periodType: periodType !== null && periodType !== void 0 ? periodType : ntx_core_1.PeriodType.MONTHLY,
|
|
50
|
+
meta: {
|
|
51
|
+
type,
|
|
52
|
+
preferences,
|
|
53
|
+
planTypes,
|
|
54
|
+
webhooks,
|
|
55
|
+
amount,
|
|
56
|
+
},
|
|
57
|
+
status: app_config_1.LicenseStatusType.Pending,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
[ntx_core_1.CrudActionType.beforeUpdate]: async (payload, context) => {
|
|
61
|
+
const { preference } = context;
|
|
62
|
+
const { user, client, workspace } = context;
|
|
63
|
+
const { type, preferences, planTypes, webhooks, amount } = payload;
|
|
64
|
+
return {
|
|
65
|
+
meta: {
|
|
66
|
+
type,
|
|
67
|
+
preferences,
|
|
68
|
+
planTypes,
|
|
69
|
+
webhooks,
|
|
70
|
+
amount,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
this.hooks = {
|
|
76
|
+
[ntx_core_1.CrudActionType.afterCreate]: async (entity, context, payload) => {
|
|
77
|
+
var _a;
|
|
78
|
+
const { preference } = context;
|
|
79
|
+
const { user, client, workspace } = context;
|
|
80
|
+
if (((_a = entity.meta) === null || _a === void 0 ? void 0 : _a.amount) < 1) {
|
|
81
|
+
return (0, ntx_core_1.error)(this.translate('apps.bridge.license.title', null, preference), this.translate('apps.bridge.license.hook.amount.invalid', null, preference));
|
|
82
|
+
}
|
|
83
|
+
await this.process(entity, context);
|
|
84
|
+
},
|
|
85
|
+
[ntx_core_1.CrudActionType.afterUpdate]: async (entity, context, payload) => {
|
|
86
|
+
const { preference } = context;
|
|
87
|
+
const { user, client, workspace } = context;
|
|
88
|
+
await this.process(entity, context);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async process(entity, context) {
|
|
93
|
+
const { preference } = context;
|
|
94
|
+
const { meta } = entity;
|
|
95
|
+
const { type, preferences, planTypes, webhooks, amount } = meta;
|
|
96
|
+
const envOverrides = preferences
|
|
97
|
+
.filter((p) => p.type === app_config_1.LicensePreferenceType.Env)
|
|
98
|
+
.reduce((prev, curr) => {
|
|
99
|
+
return Object.assign(Object.assign({}, prev), { [curr.key]: curr.value });
|
|
100
|
+
}, {});
|
|
101
|
+
const envPrevious = (await this.preferenceService.withContext(context).find({
|
|
102
|
+
where: [{ licenseId: entity.id, type: app_config_1.LicensePreferenceType.Env }],
|
|
103
|
+
})).reduce((prev, curr) => {
|
|
104
|
+
return Object.assign(Object.assign({}, prev), { [curr.key]: curr.value });
|
|
105
|
+
}, {});
|
|
106
|
+
const sanitizedEnv = Object.assign(Object.assign({}, envPrevious), envOverrides);
|
|
107
|
+
await this.preferenceService.withContext(context).delete({
|
|
108
|
+
licenseId: entity.id,
|
|
109
|
+
type: app_config_1.LicensePreferenceType.Env,
|
|
110
|
+
});
|
|
111
|
+
for (const key in sanitizedEnv) {
|
|
112
|
+
const value = sanitizedEnv[key];
|
|
113
|
+
await this.preferenceService.withContext(context).save({
|
|
114
|
+
licenseId: entity.id,
|
|
115
|
+
key,
|
|
116
|
+
value,
|
|
117
|
+
type: app_config_1.LicensePreferenceType.Env,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const flagOverrides = preferences
|
|
121
|
+
.filter((p) => p.type === app_config_1.LicensePreferenceType.Flag)
|
|
122
|
+
.reduce((prev, curr) => {
|
|
123
|
+
return Object.assign(Object.assign({}, prev), { [curr.key]: curr.value });
|
|
124
|
+
}, {});
|
|
125
|
+
const sanitizedFlag = Object.assign({}, flagOverrides);
|
|
126
|
+
await this.preferenceService.withContext(context).delete({
|
|
127
|
+
licenseId: entity.id,
|
|
128
|
+
type: app_config_1.LicensePreferenceType.Flag,
|
|
129
|
+
});
|
|
130
|
+
for (const key in sanitizedFlag) {
|
|
131
|
+
const value = sanitizedFlag[key];
|
|
132
|
+
await this.preferenceService.withContext(context).save({
|
|
133
|
+
licenseId: entity.id,
|
|
134
|
+
key,
|
|
135
|
+
value,
|
|
136
|
+
type: app_config_1.LicensePreferenceType.Flag,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
await this.planTypeService.withContext(context).delete({
|
|
140
|
+
licenseId: entity.id,
|
|
141
|
+
});
|
|
142
|
+
for (let index = 0; index < (planTypes === null || planTypes === void 0 ? void 0 : planTypes.length); index++) {
|
|
143
|
+
const planType = planTypes[index];
|
|
144
|
+
await this.planTypeService.withContext(context).save(Object.assign({ licenseId: entity.id, key: planType.name.toLowerCase().replace(/\s+/g, '-'), meta: { flags: planType.flags } }, planType));
|
|
145
|
+
}
|
|
146
|
+
await this.webhookService.withContext(context).delete({
|
|
147
|
+
licenseId: entity.id,
|
|
148
|
+
});
|
|
149
|
+
for (let index = 0; index < (webhooks === null || webhooks === void 0 ? void 0 : webhooks.length); index++) {
|
|
150
|
+
const webhook = webhooks[index];
|
|
151
|
+
const eventOverrides = webhook.events.reduce((prev, curr) => {
|
|
152
|
+
return Object.assign(Object.assign({}, prev), { [curr]: true });
|
|
153
|
+
}, {});
|
|
154
|
+
const sanitizedEvents = Object.assign({}, eventOverrides);
|
|
155
|
+
await this.webhookService.withContext(context).save({
|
|
156
|
+
licenseId: entity.id,
|
|
157
|
+
type: 'POST',
|
|
158
|
+
url: webhook.url,
|
|
159
|
+
meta: {
|
|
160
|
+
events: sanitizedEvents,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
32
164
|
}
|
|
33
165
|
};
|
|
34
166
|
exports.LicenseController = LicenseController;
|
|
@@ -36,6 +168,10 @@ exports.LicenseController = LicenseController = __decorate([
|
|
|
36
168
|
(0, common_1.Controller)('license'),
|
|
37
169
|
__metadata("design:paramtypes", [license_service_1.LicenseService,
|
|
38
170
|
ntx_core_1.LanguageService,
|
|
39
|
-
ntx_core_1.MediaService
|
|
171
|
+
ntx_core_1.MediaService,
|
|
172
|
+
config_1.ConfigService,
|
|
173
|
+
preference_1.PreferenceService,
|
|
174
|
+
plan_type_1.PlanTypeService,
|
|
175
|
+
webhook_1.WebhookService])
|
|
40
176
|
], LicenseController);
|
|
41
177
|
//# sourceMappingURL=license.controller.js.map
|