tychat-contracts 1.6.28 → 1.6.30
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/dist/billing/billing-line-item.dto.d.ts +8 -0
- package/dist/billing/billing-line-item.dto.d.ts.map +1 -0
- package/dist/billing/billing-line-item.dto.js +74 -0
- package/dist/billing/billing-response.dto.d.ts +5 -1
- package/dist/billing/billing-response.dto.d.ts.map +1 -1
- package/dist/billing/billing-response.dto.js +28 -0
- package/dist/billing/create-billing.dto.d.ts +6 -0
- package/dist/billing/create-billing.dto.d.ts.map +1 -1
- package/dist/billing/create-billing.dto.js +37 -1
- package/dist/billing/index.d.ts +1 -0
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/index.js +1 -0
- package/dist/panel-rbac/dashboard-layout.dto.d.ts +1 -1
- package/dist/panel-rbac/dashboard-layout.dto.d.ts.map +1 -1
- package/dist/panel-rbac/dashboard-layout.dto.js +3 -0
- package/dist/panel-rbac/panel-permission-keys.d.ts +1 -0
- package/dist/panel-rbac/panel-permission-keys.d.ts.map +1 -1
- package/dist/panel-rbac/panel-permission-keys.js +1 -0
- package/package.json +1 -1
- package/src/billing/billing-line-item.dto.ts +57 -0
- package/src/billing/billing-response.dto.ts +24 -0
- package/src/billing/create-billing.dto.ts +34 -0
- package/src/billing/index.ts +1 -0
- package/src/panel-rbac/dashboard-layout.dto.ts +3 -0
- package/src/panel-rbac/panel-permission-keys.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-line-item.dto.d.ts","sourceRoot":"","sources":["../../src/billing/billing-line-item.dto.ts"],"names":[],"mappings":"AAUA,qBAAa,kBAAkB;IAO7B,IAAI,EAAE,MAAM,CAAC;IAQb,KAAK,EAAE,MAAM,CAAC;IAUd,MAAM,EAAE,MAAM,CAAC;IAUf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAUlB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BillingLineItemDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
class BillingLineItemDto {
|
|
17
|
+
code;
|
|
18
|
+
label;
|
|
19
|
+
amount;
|
|
20
|
+
quantity;
|
|
21
|
+
unitAmount;
|
|
22
|
+
}
|
|
23
|
+
exports.BillingLineItemDto = BillingLineItemDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({
|
|
26
|
+
description: 'Código estável da linha (ex.: PLAN_BASE, EXTRA_PATIENTS)',
|
|
27
|
+
example: 'PLAN_BASE',
|
|
28
|
+
}),
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.MaxLength)(64),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], BillingLineItemDto.prototype, "code", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({
|
|
35
|
+
description: 'Rótulo exibido (snapshot em PT-BR na emissão)',
|
|
36
|
+
example: 'Plano',
|
|
37
|
+
}),
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.MaxLength)(256),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], BillingLineItemDto.prototype, "label", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({
|
|
44
|
+
description: 'Valor da linha (moeda do tenant / BRL)',
|
|
45
|
+
example: 99.9,
|
|
46
|
+
minimum: 0,
|
|
47
|
+
}),
|
|
48
|
+
(0, class_validator_1.IsNumber)(),
|
|
49
|
+
(0, class_validator_1.Min)(0),
|
|
50
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
51
|
+
__metadata("design:type", Number)
|
|
52
|
+
], BillingLineItemDto.prototype, "amount", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
55
|
+
description: 'Quantidade (ex.: pacientes adicionais)',
|
|
56
|
+
example: 5,
|
|
57
|
+
}),
|
|
58
|
+
(0, class_validator_1.IsOptional)(),
|
|
59
|
+
(0, class_validator_1.IsNumber)(),
|
|
60
|
+
(0, class_validator_1.Min)(0),
|
|
61
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
62
|
+
__metadata("design:type", Number)
|
|
63
|
+
], BillingLineItemDto.prototype, "quantity", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
66
|
+
description: 'Valor unitário',
|
|
67
|
+
example: 10,
|
|
68
|
+
}),
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, class_validator_1.IsNumber)(),
|
|
71
|
+
(0, class_validator_1.Min)(0),
|
|
72
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
73
|
+
__metadata("design:type", Number)
|
|
74
|
+
], BillingLineItemDto.prototype, "unitAmount", void 0);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BillingLineItemDto } from './billing-line-item.dto';
|
|
2
|
+
import { BillingKindDto, BillingStatusDto } from './create-billing.dto';
|
|
2
3
|
export declare class BillingResponseDto {
|
|
3
4
|
id: string;
|
|
4
5
|
tenantId: string;
|
|
6
|
+
kind: BillingKindDto;
|
|
7
|
+
referenceId?: string | null;
|
|
5
8
|
value: number;
|
|
9
|
+
lineItems?: BillingLineItemDto[] | null;
|
|
6
10
|
status: BillingStatusDto;
|
|
7
11
|
paymentId?: string | null;
|
|
8
12
|
dueDate: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-response.dto.d.ts","sourceRoot":"","sources":["../../src/billing/billing-response.dto.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"billing-response.dto.d.ts","sourceRoot":"","sources":["../../src/billing/billing-response.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAGL,cAAc,EACd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,kBAAkB;IAK7B,EAAE,EAAE,MAAM,CAAC;IAMX,QAAQ,EAAE,MAAM,CAAC;IAOjB,IAAI,EAAE,cAAc,CAAC;IAOrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAM5B,KAAK,EAAE,MAAM,CAAC;IAOd,SAAS,CAAC,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IAOxC,MAAM,EAAE,gBAAgB,CAAC;IAMzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAM1B,OAAO,EAAE,MAAM,CAAC;IAMhB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAMxB,SAAS,EAAE,MAAM,CAAC;IAMlB,SAAS,EAAE,MAAM,CAAC;IAMlB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
|
|
@@ -11,11 +11,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BillingResponseDto = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const billing_line_item_dto_1 = require("./billing-line-item.dto");
|
|
14
15
|
const create_billing_dto_1 = require("./create-billing.dto");
|
|
15
16
|
class BillingResponseDto {
|
|
16
17
|
id;
|
|
17
18
|
tenantId;
|
|
19
|
+
kind;
|
|
20
|
+
referenceId;
|
|
18
21
|
value;
|
|
22
|
+
lineItems;
|
|
19
23
|
status;
|
|
20
24
|
paymentId;
|
|
21
25
|
dueDate;
|
|
@@ -39,6 +43,22 @@ __decorate([
|
|
|
39
43
|
}),
|
|
40
44
|
__metadata("design:type", String)
|
|
41
45
|
], BillingResponseDto.prototype, "tenantId", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, swagger_1.ApiProperty)({
|
|
48
|
+
description: 'Tipo de fatura',
|
|
49
|
+
enum: create_billing_dto_1.BILLING_KINDS,
|
|
50
|
+
example: 'SUBSCRIPTION',
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], BillingResponseDto.prototype, "kind", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
56
|
+
description: 'ID de referência (ex.: campanha)',
|
|
57
|
+
example: null,
|
|
58
|
+
nullable: true,
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], BillingResponseDto.prototype, "referenceId", void 0);
|
|
42
62
|
__decorate([
|
|
43
63
|
(0, swagger_1.ApiProperty)({
|
|
44
64
|
description: 'Billing value',
|
|
@@ -46,6 +66,14 @@ __decorate([
|
|
|
46
66
|
}),
|
|
47
67
|
__metadata("design:type", Number)
|
|
48
68
|
], BillingResponseDto.prototype, "value", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
71
|
+
description: 'Linhas da fatura (snapshot na emissão)',
|
|
72
|
+
type: [billing_line_item_dto_1.BillingLineItemDto],
|
|
73
|
+
nullable: true,
|
|
74
|
+
}),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], BillingResponseDto.prototype, "lineItems", void 0);
|
|
49
77
|
__decorate([
|
|
50
78
|
(0, swagger_1.ApiProperty)({
|
|
51
79
|
description: 'Billing status',
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { BillingLineItemDto } from './billing-line-item.dto';
|
|
1
2
|
export declare const BILLING_STATUSES: readonly ["PENDING", "PAYED", "REFUNDED", "CANCELED", "OVERDUE"];
|
|
2
3
|
export type BillingStatusDto = (typeof BILLING_STATUSES)[number];
|
|
4
|
+
export declare const BILLING_KINDS: readonly ["SUBSCRIPTION", "CAMPAIGN", "OTHER"];
|
|
5
|
+
export type BillingKindDto = (typeof BILLING_KINDS)[number];
|
|
3
6
|
export declare class CreateBillingDto {
|
|
4
7
|
tenantId: string;
|
|
5
8
|
value: number;
|
|
@@ -7,5 +10,8 @@ export declare class CreateBillingDto {
|
|
|
7
10
|
paymentId?: string;
|
|
8
11
|
dueDate: string;
|
|
9
12
|
payedAt?: string;
|
|
13
|
+
kind?: BillingKindDto;
|
|
14
|
+
referenceId?: string;
|
|
15
|
+
lineItems?: BillingLineItemDto[];
|
|
10
16
|
}
|
|
11
17
|
//# sourceMappingURL=create-billing.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-billing.dto.d.ts","sourceRoot":"","sources":["../../src/billing/create-billing.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-billing.dto.d.ts","sourceRoot":"","sources":["../../src/billing/create-billing.dto.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,kEAMnB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,aAAa,gDAAiD,CAAC;AAC5E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,qBAAa,gBAAgB;IAO3B,QAAQ,EAAE,MAAM,CAAC;IASjB,KAAK,EAAE,MAAM,CAAC;IASd,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAQ1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAOnB,OAAO,EAAE,MAAM,CAAC;IAQhB,OAAO,CAAC,EAAE,MAAM,CAAC;IASjB,IAAI,CAAC,EAAE,cAAc,CAAC;IAQtB,WAAW,CAAC,EAAE,MAAM,CAAC;IAUrB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC"}
|
|
@@ -9,9 +9,11 @@ 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.CreateBillingDto = exports.BILLING_STATUSES = void 0;
|
|
12
|
+
exports.CreateBillingDto = exports.BILLING_KINDS = exports.BILLING_STATUSES = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
const class_validator_1 = require("class-validator");
|
|
16
|
+
const billing_line_item_dto_1 = require("./billing-line-item.dto");
|
|
15
17
|
exports.BILLING_STATUSES = [
|
|
16
18
|
'PENDING',
|
|
17
19
|
'PAYED',
|
|
@@ -19,6 +21,7 @@ exports.BILLING_STATUSES = [
|
|
|
19
21
|
'CANCELED',
|
|
20
22
|
'OVERDUE',
|
|
21
23
|
];
|
|
24
|
+
exports.BILLING_KINDS = ['SUBSCRIPTION', 'CAMPAIGN', 'OTHER'];
|
|
22
25
|
class CreateBillingDto {
|
|
23
26
|
tenantId;
|
|
24
27
|
value;
|
|
@@ -26,6 +29,9 @@ class CreateBillingDto {
|
|
|
26
29
|
paymentId;
|
|
27
30
|
dueDate;
|
|
28
31
|
payedAt;
|
|
32
|
+
kind;
|
|
33
|
+
referenceId;
|
|
34
|
+
lineItems;
|
|
29
35
|
}
|
|
30
36
|
exports.CreateBillingDto = CreateBillingDto;
|
|
31
37
|
__decorate([
|
|
@@ -83,3 +89,33 @@ __decorate([
|
|
|
83
89
|
(0, class_validator_1.IsDateString)(),
|
|
84
90
|
__metadata("design:type", String)
|
|
85
91
|
], CreateBillingDto.prototype, "payedAt", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
94
|
+
description: 'Tipo de fatura',
|
|
95
|
+
enum: exports.BILLING_KINDS,
|
|
96
|
+
default: 'SUBSCRIPTION',
|
|
97
|
+
}),
|
|
98
|
+
(0, class_validator_1.IsOptional)(),
|
|
99
|
+
(0, class_validator_1.IsEnum)(exports.BILLING_KINDS),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], CreateBillingDto.prototype, "kind", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
104
|
+
description: 'ID de referência (ex.: campanha)',
|
|
105
|
+
example: '550e8400-e29b-41d4-a716-446655440099',
|
|
106
|
+
}),
|
|
107
|
+
(0, class_validator_1.IsOptional)(),
|
|
108
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
109
|
+
__metadata("design:type", String)
|
|
110
|
+
], CreateBillingDto.prototype, "referenceId", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
113
|
+
description: 'Linhas da fatura (snapshot); se omitido, o serviço deriva uma linha única',
|
|
114
|
+
type: [billing_line_item_dto_1.BillingLineItemDto],
|
|
115
|
+
}),
|
|
116
|
+
(0, class_validator_1.IsOptional)(),
|
|
117
|
+
(0, class_validator_1.IsArray)(),
|
|
118
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
119
|
+
(0, class_transformer_1.Type)(() => billing_line_item_dto_1.BillingLineItemDto),
|
|
120
|
+
__metadata("design:type", Array)
|
|
121
|
+
], CreateBillingDto.prototype, "lineItems", void 0);
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC"}
|
package/dist/billing/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./billing-line-item.dto"), exports);
|
|
17
18
|
__exportStar(require("./create-billing.dto"), exports);
|
|
18
19
|
__exportStar(require("./update-billing.dto"), exports);
|
|
19
20
|
__exportStar(require("./list-billings-query.dto"), exports);
|
|
@@ -5,7 +5,7 @@ export type DashboardChartType = (typeof DASHBOARD_CHART_TYPES)[number];
|
|
|
5
5
|
* Módulos de dados agregados do dashboard (cada um mapeia a permissões e a fatia do summary).
|
|
6
6
|
* Manter alinhado ao `Frontend/.../lib/dashboard-data-modules.ts`.
|
|
7
7
|
*/
|
|
8
|
-
export declare const DASHBOARD_DATA_MODULE_KEYS: readonly ["overview.clients_total", "overview.clients_active_inactive", "overview.units_total", "overview.revenue_totals", "overview.revenue_growth", "overview.estimated_mrr", "overview.clients_per_plan", "overview.recent_signups", "overview.invoice_counts", "billing.revenue_by_status", "billing.invoice_status_breakdown", "billing.invoice_counts", "billing.recent_invoices", "billing.payment_links", "tenants.client_list", "tenants.plan_per_client", "tenants.legal_term_policy", "tenants.whatsapp_provider", "tenants.scheduled_deletion", "tenants.hostnames", "tenants.storage_usage", "infra.storage_overview", "infra.storage_by_tenant", "limits.per_client", "limits.session_policy", "limits.extra_storage", "plans.stats", "plans.list", "plans.active_inactive", "ia.tokens_per_tenant", "ia.agents_per_tenant", "ia.agents_summary", "ia.tool_policies", "ia.models_availability", "evolution.configs_summary", "evolution.instances_totals", "evolution.connection_state", "global.platform_config", "team.panel_admins", "audit.recent_events", "audit.outcome_counts", "security.device_sessions", "security.totp_status"];
|
|
8
|
+
export declare const DASHBOARD_DATA_MODULE_KEYS: readonly ["overview.clients_total", "overview.clients_active_inactive", "overview.units_total", "overview.revenue_totals", "overview.revenue_growth", "overview.estimated_mrr", "overview.clients_per_plan", "overview.recent_signups", "overview.invoice_counts", "billing.revenue_by_status", "billing.invoice_status_breakdown", "billing.invoice_counts", "billing.recent_invoices", "billing.payment_links", "tenants.client_list", "tenants.plan_per_client", "tenants.legal_term_policy", "tenants.whatsapp_provider", "tenants.scheduled_deletion", "tenants.hostnames", "tenants.storage_usage", "infra.storage_overview", "infra.storage_by_tenant", "limits.per_client", "limits.session_policy", "limits.extra_storage", "plans.stats", "plans.list", "plans.active_inactive", "ia.tokens_per_tenant", "ia.agents_per_tenant", "ia.agents_summary", "ia.tool_policies", "ia.models_availability", "evolution.configs_summary", "evolution.instances_totals", "evolution.connection_state", "global.platform_config", "team.panel_admins", "audit.recent_events", "audit.outcome_counts", "security.device_sessions", "security.totp_status", "refunds.volume_by_month", "refunds.by_status", "refunds.top_tenants"];
|
|
9
9
|
export type DashboardDataModuleKey = (typeof DASHBOARD_DATA_MODULE_KEYS)[number];
|
|
10
10
|
export declare function isDashboardDataModuleKey(v: string): v is DashboardDataModuleKey;
|
|
11
11
|
/** Posição e tamanho no painel em percentagem (0–100) relativamente ao contentor do canvas. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-layout.dto.d.ts","sourceRoot":"","sources":["../../src/panel-rbac/dashboard-layout.dto.ts"],"names":[],"mappings":"AAiBA,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,4EASxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"dashboard-layout.dto.d.ts","sourceRoot":"","sources":["../../src/panel-rbac/dashboard-layout.dto.ts"],"names":[],"mappings":"AAiBA,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,4EASxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,iqCA+C7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,sBAAsB,CAE/E;AAED,+FAA+F;AAC/F,qBAAa,sBAAsB;IAMjC,OAAO,EAAE,MAAM,CAAC;IAOhB,MAAM,EAAE,MAAM,CAAC;IAOf,QAAQ,EAAE,MAAM,CAAC;IAOjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,kBAAkB;IAG7B,EAAE,EAAE,MAAM,CAAC;IAKX,UAAU,EAAE,sBAAsB,CAAC;IAKnC,SAAS,EAAE,kBAAkB,CAAC;IAE9B,0CAA0C;IAK1C,CAAC,EAAE,MAAM,CAAC;IAEV,iCAAiC;IAKjC,CAAC,EAAE,MAAM,CAAC;IAEV;;;OAGG;IAOH,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX,2CAA2C;IAI3C,KAAK,EAAE,MAAM,CAAC;IAMd,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0HAA0H;IAK1H,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC;AAED,qBAAa,kBAAkB;IAK7B,OAAO,EAAE,MAAM,CAAC;IAOhB,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B"}
|
|
@@ -73,6 +73,9 @@ exports.DASHBOARD_DATA_MODULE_KEYS = [
|
|
|
73
73
|
'audit.outcome_counts',
|
|
74
74
|
'security.device_sessions',
|
|
75
75
|
'security.totp_status',
|
|
76
|
+
'refunds.volume_by_month',
|
|
77
|
+
'refunds.by_status',
|
|
78
|
+
'refunds.top_tenants',
|
|
76
79
|
];
|
|
77
80
|
function isDashboardDataModuleKey(v) {
|
|
78
81
|
return exports.DASHBOARD_DATA_MODULE_KEYS.includes(v);
|
|
@@ -19,6 +19,7 @@ export declare const PANEL_RESOURCE_ACTIONS: {
|
|
|
19
19
|
readonly admin_users: readonly ["view", "create", "update", "delete"];
|
|
20
20
|
readonly access_levels: readonly ["view", "create", "update", "delete"];
|
|
21
21
|
readonly conversation: readonly ["execute"];
|
|
22
|
+
readonly campaign_refunds: readonly ["view", "process", "cancel"];
|
|
22
23
|
};
|
|
23
24
|
export type PanelResource = keyof typeof PANEL_RESOURCE_ACTIONS;
|
|
24
25
|
export type PanelAction<R extends PanelResource> = (typeof PANEL_RESOURCE_ACTIONS)[R][number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-permission-keys.d.ts","sourceRoot":"","sources":["../../src/panel-rbac/panel-permission-keys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"panel-permission-keys.d.ts","sourceRoot":"","sources":["../../src/panel-rbac/panel-permission-keys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;CA2BzB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAEhE,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,aAAa,IAC7C,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAS7C,eAAO,MAAM,qBAAqB,EAAW,SAAS,MAAM,EAAE,CAAC;AAE/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE/E;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,GACjC,kBAAkB,CAEpB"}
|
|
@@ -32,6 +32,7 @@ exports.PANEL_RESOURCE_ACTIONS = {
|
|
|
32
32
|
admin_users: ['view', 'create', 'update', 'delete'],
|
|
33
33
|
access_levels: ['view', 'create', 'update', 'delete'],
|
|
34
34
|
conversation: ['execute'],
|
|
35
|
+
campaign_refunds: ['view', 'process', 'cancel'],
|
|
35
36
|
};
|
|
36
37
|
const keys = [];
|
|
37
38
|
for (const [resource, actions] of Object.entries(exports.PANEL_RESOURCE_ACTIONS)) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
IsNumber,
|
|
5
|
+
IsOptional,
|
|
6
|
+
IsString,
|
|
7
|
+
MaxLength,
|
|
8
|
+
Min,
|
|
9
|
+
} from 'class-validator';
|
|
10
|
+
|
|
11
|
+
export class BillingLineItemDto {
|
|
12
|
+
@ApiProperty({
|
|
13
|
+
description: 'Código estável da linha (ex.: PLAN_BASE, EXTRA_PATIENTS)',
|
|
14
|
+
example: 'PLAN_BASE',
|
|
15
|
+
})
|
|
16
|
+
@IsString()
|
|
17
|
+
@MaxLength(64)
|
|
18
|
+
code: string;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({
|
|
21
|
+
description: 'Rótulo exibido (snapshot em PT-BR na emissão)',
|
|
22
|
+
example: 'Plano',
|
|
23
|
+
})
|
|
24
|
+
@IsString()
|
|
25
|
+
@MaxLength(256)
|
|
26
|
+
label: string;
|
|
27
|
+
|
|
28
|
+
@ApiProperty({
|
|
29
|
+
description: 'Valor da linha (moeda do tenant / BRL)',
|
|
30
|
+
example: 99.9,
|
|
31
|
+
minimum: 0,
|
|
32
|
+
})
|
|
33
|
+
@IsNumber()
|
|
34
|
+
@Min(0)
|
|
35
|
+
@Type(() => Number)
|
|
36
|
+
amount: number;
|
|
37
|
+
|
|
38
|
+
@ApiPropertyOptional({
|
|
39
|
+
description: 'Quantidade (ex.: pacientes adicionais)',
|
|
40
|
+
example: 5,
|
|
41
|
+
})
|
|
42
|
+
@IsOptional()
|
|
43
|
+
@IsNumber()
|
|
44
|
+
@Min(0)
|
|
45
|
+
@Type(() => Number)
|
|
46
|
+
quantity?: number;
|
|
47
|
+
|
|
48
|
+
@ApiPropertyOptional({
|
|
49
|
+
description: 'Valor unitário',
|
|
50
|
+
example: 10,
|
|
51
|
+
})
|
|
52
|
+
@IsOptional()
|
|
53
|
+
@IsNumber()
|
|
54
|
+
@Min(0)
|
|
55
|
+
@Type(() => Number)
|
|
56
|
+
unitAmount?: number;
|
|
57
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { BillingLineItemDto } from './billing-line-item.dto';
|
|
2
3
|
import {
|
|
4
|
+
BILLING_KINDS,
|
|
3
5
|
BILLING_STATUSES,
|
|
6
|
+
BillingKindDto,
|
|
4
7
|
BillingStatusDto,
|
|
5
8
|
} from './create-billing.dto';
|
|
6
9
|
|
|
@@ -17,12 +20,33 @@ export class BillingResponseDto {
|
|
|
17
20
|
})
|
|
18
21
|
tenantId: string;
|
|
19
22
|
|
|
23
|
+
@ApiProperty({
|
|
24
|
+
description: 'Tipo de fatura',
|
|
25
|
+
enum: BILLING_KINDS,
|
|
26
|
+
example: 'SUBSCRIPTION',
|
|
27
|
+
})
|
|
28
|
+
kind: BillingKindDto;
|
|
29
|
+
|
|
30
|
+
@ApiPropertyOptional({
|
|
31
|
+
description: 'ID de referência (ex.: campanha)',
|
|
32
|
+
example: null,
|
|
33
|
+
nullable: true,
|
|
34
|
+
})
|
|
35
|
+
referenceId?: string | null;
|
|
36
|
+
|
|
20
37
|
@ApiProperty({
|
|
21
38
|
description: 'Billing value',
|
|
22
39
|
example: 99.9,
|
|
23
40
|
})
|
|
24
41
|
value: number;
|
|
25
42
|
|
|
43
|
+
@ApiPropertyOptional({
|
|
44
|
+
description: 'Linhas da fatura (snapshot na emissão)',
|
|
45
|
+
type: [BillingLineItemDto],
|
|
46
|
+
nullable: true,
|
|
47
|
+
})
|
|
48
|
+
lineItems?: BillingLineItemDto[] | null;
|
|
49
|
+
|
|
26
50
|
@ApiProperty({
|
|
27
51
|
description: 'Billing status',
|
|
28
52
|
enum: BILLING_STATUSES,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
2
3
|
import {
|
|
4
|
+
IsArray,
|
|
3
5
|
IsDateString,
|
|
4
6
|
IsEnum,
|
|
5
7
|
IsNotEmpty,
|
|
@@ -7,7 +9,9 @@ import {
|
|
|
7
9
|
IsOptional,
|
|
8
10
|
IsUUID,
|
|
9
11
|
Min,
|
|
12
|
+
ValidateNested,
|
|
10
13
|
} from 'class-validator';
|
|
14
|
+
import { BillingLineItemDto } from './billing-line-item.dto';
|
|
11
15
|
|
|
12
16
|
export const BILLING_STATUSES = [
|
|
13
17
|
'PENDING',
|
|
@@ -18,6 +22,9 @@ export const BILLING_STATUSES = [
|
|
|
18
22
|
] as const;
|
|
19
23
|
export type BillingStatusDto = (typeof BILLING_STATUSES)[number];
|
|
20
24
|
|
|
25
|
+
export const BILLING_KINDS = ['SUBSCRIPTION', 'CAMPAIGN', 'OTHER'] as const;
|
|
26
|
+
export type BillingKindDto = (typeof BILLING_KINDS)[number];
|
|
27
|
+
|
|
21
28
|
export class CreateBillingDto {
|
|
22
29
|
@ApiProperty({
|
|
23
30
|
description: 'Tenant ID (UUID)',
|
|
@@ -67,4 +74,31 @@ export class CreateBillingDto {
|
|
|
67
74
|
@IsOptional()
|
|
68
75
|
@IsDateString()
|
|
69
76
|
payedAt?: string;
|
|
77
|
+
|
|
78
|
+
@ApiPropertyOptional({
|
|
79
|
+
description: 'Tipo de fatura',
|
|
80
|
+
enum: BILLING_KINDS,
|
|
81
|
+
default: 'SUBSCRIPTION',
|
|
82
|
+
})
|
|
83
|
+
@IsOptional()
|
|
84
|
+
@IsEnum(BILLING_KINDS)
|
|
85
|
+
kind?: BillingKindDto;
|
|
86
|
+
|
|
87
|
+
@ApiPropertyOptional({
|
|
88
|
+
description: 'ID de referência (ex.: campanha)',
|
|
89
|
+
example: '550e8400-e29b-41d4-a716-446655440099',
|
|
90
|
+
})
|
|
91
|
+
@IsOptional()
|
|
92
|
+
@IsUUID('4')
|
|
93
|
+
referenceId?: string;
|
|
94
|
+
|
|
95
|
+
@ApiPropertyOptional({
|
|
96
|
+
description: 'Linhas da fatura (snapshot); se omitido, o serviço deriva uma linha única',
|
|
97
|
+
type: [BillingLineItemDto],
|
|
98
|
+
})
|
|
99
|
+
@IsOptional()
|
|
100
|
+
@IsArray()
|
|
101
|
+
@ValidateNested({ each: true })
|
|
102
|
+
@Type(() => BillingLineItemDto)
|
|
103
|
+
lineItems?: BillingLineItemDto[];
|
|
70
104
|
}
|
package/src/billing/index.ts
CHANGED
|
@@ -77,6 +77,9 @@ export const DASHBOARD_DATA_MODULE_KEYS = [
|
|
|
77
77
|
'audit.outcome_counts',
|
|
78
78
|
'security.device_sessions',
|
|
79
79
|
'security.totp_status',
|
|
80
|
+
'refunds.volume_by_month',
|
|
81
|
+
'refunds.by_status',
|
|
82
|
+
'refunds.top_tenants',
|
|
80
83
|
] as const;
|
|
81
84
|
|
|
82
85
|
export type DashboardDataModuleKey = (typeof DASHBOARD_DATA_MODULE_KEYS)[number];
|
|
@@ -27,6 +27,7 @@ export const PANEL_RESOURCE_ACTIONS = {
|
|
|
27
27
|
admin_users: ['view', 'create', 'update', 'delete'] as const,
|
|
28
28
|
access_levels: ['view', 'create', 'update', 'delete'] as const,
|
|
29
29
|
conversation: ['execute'] as const,
|
|
30
|
+
campaign_refunds: ['view', 'process', 'cancel'] as const,
|
|
30
31
|
} as const;
|
|
31
32
|
|
|
32
33
|
export type PanelResource = keyof typeof PANEL_RESOURCE_ACTIONS;
|