tychat-contracts 1.0.113 → 1.0.118
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/appointments/list-appointments-query.dto.js +1 -1
- package/dist/billing/billing-detail-response.dto.d.ts +9 -0
- package/dist/billing/billing-detail-response.dto.d.ts.map +1 -0
- package/dist/billing/billing-detail-response.dto.js +31 -0
- package/dist/billing/billing-linked-payment.dto.d.ts +17 -0
- package/dist/billing/billing-linked-payment.dto.d.ts.map +1 -0
- package/dist/billing/billing-linked-payment.dto.js +70 -0
- package/dist/billing/index.d.ts +2 -0
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/index.js +2 -0
- package/dist/billing/list-billings-query.dto.d.ts +1 -3
- package/dist/billing/list-billings-query.dto.d.ts.map +1 -1
- package/dist/billing/list-billings-query.dto.js +0 -20
- package/dist/conversations/conversation-contact-filters-query.validator.spec.js +1 -1
- package/dist/conversations/followup-log-list-query.dto.js +1 -1
- package/dist/conversations/list-conversation-contacts-query.dto.js +1 -1
- package/dist/conversations/list-conversation-sessions-query.dto.js +1 -1
- package/dist/filters/parsed-filter.dto.d.ts +4 -2
- package/dist/filters/parsed-filter.dto.d.ts.map +1 -1
- package/dist/filters/parsed-filter.dto.js +4 -0
- package/dist/patients/list-patients-query.dto.js +1 -1
- package/dist/payment-gateway/list-gateway-payments-query.dto.d.ts +1 -0
- package/dist/payment-gateway/list-gateway-payments-query.dto.d.ts.map +1 -1
- package/dist/payment-gateway/list-gateway-payments-query.dto.js +14 -2
- package/dist/procedures/list-procedures-query.dto.js +1 -1
- package/package.json +1 -1
- package/src/appointments/list-appointments-query.dto.ts +1 -1
- package/src/billing/billing-detail-response.dto.ts +17 -0
- package/src/billing/billing-linked-payment.dto.ts +37 -0
- package/src/billing/index.ts +2 -0
- package/src/billing/list-billings-query.dto.ts +0 -18
- package/src/conversations/conversation-contact-filters-query.validator.spec.ts +1 -1
- package/src/conversations/followup-log-list-query.dto.ts +1 -1
- package/src/conversations/list-conversation-contacts-query.dto.ts +1 -1
- package/src/conversations/list-conversation-sessions-query.dto.ts +1 -1
- package/src/filters/parsed-filter.dto.ts +5 -1
- package/src/patients/list-patients-query.dto.ts +1 -1
- package/src/payment-gateway/list-gateway-payments-query.dto.ts +13 -3
- package/src/procedures/list-procedures-query.dto.ts +1 -1
|
@@ -168,7 +168,7 @@ __decorate([
|
|
|
168
168
|
(0, swagger_1.ApiPropertyOptional)({
|
|
169
169
|
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
170
170
|
'Example: `[{"key":"status","op":"==","value":"pending"}]`. ' +
|
|
171
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
171
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
172
172
|
type: String,
|
|
173
173
|
example: '[{"key":"status","op":"==","value":"pending"}]',
|
|
174
174
|
}),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BillingLinkedPaymentDto } from './billing-linked-payment.dto';
|
|
2
|
+
import { BillingResponseDto } from './billing-response.dto';
|
|
3
|
+
/**
|
|
4
|
+
* Resposta de GET /billings/{id}: fatura + histórico de pagamentos no gateway.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BillingDetailResponseDto extends BillingResponseDto {
|
|
7
|
+
payments: BillingLinkedPaymentDto[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=billing-detail-response.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-detail-response.dto.d.ts","sourceRoot":"","sources":["../../src/billing/billing-detail-response.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,kBAAkB;IAO9D,QAAQ,EAAG,uBAAuB,EAAE,CAAC;CACtC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.BillingDetailResponseDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const billing_linked_payment_dto_1 = require("./billing-linked-payment.dto");
|
|
16
|
+
const billing_response_dto_1 = require("./billing-response.dto");
|
|
17
|
+
/**
|
|
18
|
+
* Resposta de GET /billings/{id}: fatura + histórico de pagamentos no gateway.
|
|
19
|
+
*/
|
|
20
|
+
class BillingDetailResponseDto extends billing_response_dto_1.BillingResponseDto {
|
|
21
|
+
payments;
|
|
22
|
+
}
|
|
23
|
+
exports.BillingDetailResponseDto = BillingDetailResponseDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({
|
|
26
|
+
type: [billing_linked_payment_dto_1.BillingLinkedPaymentDto],
|
|
27
|
+
description: 'Todos os registros de pagamento no gateway para esta fatura (qualquer status), mais recentes primeiro.',
|
|
28
|
+
}),
|
|
29
|
+
(0, class_transformer_1.Type)(() => billing_linked_payment_dto_1.BillingLinkedPaymentDto),
|
|
30
|
+
__metadata("design:type", Array)
|
|
31
|
+
], BillingDetailResponseDto.prototype, "payments", void 0);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resumo de um pagamento no gateway vinculado a uma fatura (listagem).
|
|
3
|
+
* Sem `metadata` para evitar payload grande (PIX QR, etc.).
|
|
4
|
+
*/
|
|
5
|
+
export declare class BillingLinkedPaymentDto {
|
|
6
|
+
id: string;
|
|
7
|
+
billingId: string;
|
|
8
|
+
amount: number;
|
|
9
|
+
gateway: string;
|
|
10
|
+
method: string;
|
|
11
|
+
status: string;
|
|
12
|
+
externalId?: string | null;
|
|
13
|
+
paidAt?: string | null;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=billing-linked-payment.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-linked-payment.dto.d.ts","sourceRoot":"","sources":["../../src/billing/billing-linked-payment.dto.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,uBAAuB;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,SAAS,EAAE,MAAM,CAAC;IAGlB,MAAM,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;IAGf,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.BillingLinkedPaymentDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
/**
|
|
15
|
+
* Resumo de um pagamento no gateway vinculado a uma fatura (listagem).
|
|
16
|
+
* Sem `metadata` para evitar payload grande (PIX QR, etc.).
|
|
17
|
+
*/
|
|
18
|
+
class BillingLinkedPaymentDto {
|
|
19
|
+
id;
|
|
20
|
+
billingId;
|
|
21
|
+
amount;
|
|
22
|
+
gateway;
|
|
23
|
+
method;
|
|
24
|
+
status;
|
|
25
|
+
externalId;
|
|
26
|
+
paidAt;
|
|
27
|
+
createdAt;
|
|
28
|
+
updatedAt;
|
|
29
|
+
}
|
|
30
|
+
exports.BillingLinkedPaymentDto = BillingLinkedPaymentDto;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do pagamento no gateway (UUID)' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], BillingLinkedPaymentDto.prototype, "id", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiProperty)({ description: 'ID da fatura (UUID)' }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], BillingLinkedPaymentDto.prototype, "billingId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, swagger_1.ApiProperty)({ description: 'Valor cobrado' }),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], BillingLinkedPaymentDto.prototype, "amount", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiProperty)({ description: 'PSP (ASAAS, MERCADO_PAGO, STRIPE)' }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], BillingLinkedPaymentDto.prototype, "gateway", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiProperty)({ description: 'Meio (PIX, CREDIT_CARD, …)' }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], BillingLinkedPaymentDto.prototype, "method", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, swagger_1.ApiProperty)({ description: 'Status no gateway' }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], BillingLinkedPaymentDto.prototype, "status", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'ID externo no PSP' }),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], BillingLinkedPaymentDto.prototype, "externalId", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'Data de confirmação/pagamento (ISO 8601)' }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], BillingLinkedPaymentDto.prototype, "paidAt", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)({ description: 'Criação (ISO 8601)' }),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], BillingLinkedPaymentDto.prototype, "createdAt", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, swagger_1.ApiProperty)({ description: 'Atualização (ISO 8601)' }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], BillingLinkedPaymentDto.prototype, "updatedAt", void 0);
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './create-billing.dto';
|
|
2
2
|
export * from './update-billing.dto';
|
|
3
3
|
export * from './list-billings-query.dto';
|
|
4
|
+
export * from './billing-linked-payment.dto';
|
|
4
5
|
export * from './billing-response.dto';
|
|
6
|
+
export * from './billing-detail-response.dto';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,wBAAwB,CAAC"}
|
|
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"}
|
package/dist/billing/index.js
CHANGED
|
@@ -17,4 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./create-billing.dto"), exports);
|
|
18
18
|
__exportStar(require("./update-billing.dto"), exports);
|
|
19
19
|
__exportStar(require("./list-billings-query.dto"), exports);
|
|
20
|
+
__exportStar(require("./billing-linked-payment.dto"), exports);
|
|
20
21
|
__exportStar(require("./billing-response.dto"), exports);
|
|
22
|
+
__exportStar(require("./billing-detail-response.dto"), exports);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { BillingStatusDto } from './create-billing.dto';
|
|
2
|
-
import { type GatewayPaymentMethodDto
|
|
2
|
+
import { type GatewayPaymentMethodDto } from '../payment-gateway/payment-gateway.enums';
|
|
3
3
|
export declare class ListBillingsQueryDto {
|
|
4
4
|
tenantId?: string;
|
|
5
5
|
status?: BillingStatusDto;
|
|
6
|
-
paymentId?: string;
|
|
7
6
|
method?: GatewayPaymentMethodDto;
|
|
8
|
-
gateway?: PaymentGatewayDto;
|
|
9
7
|
page?: number;
|
|
10
8
|
limit?: number;
|
|
11
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-billings-query.dto.d.ts","sourceRoot":"","sources":["../../src/billing/list-billings-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"list-billings-query.dto.d.ts","sourceRoot":"","sources":["../../src/billing/list-billings-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,0CAA0C,CAAC;AAElD,qBAAa,oBAAoB;IAO/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IASlB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAQ1B,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAWjC,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -17,9 +17,7 @@ const payment_gateway_enums_1 = require("../payment-gateway/payment-gateway.enum
|
|
|
17
17
|
class ListBillingsQueryDto {
|
|
18
18
|
tenantId;
|
|
19
19
|
status;
|
|
20
|
-
paymentId;
|
|
21
20
|
method;
|
|
22
|
-
gateway;
|
|
23
21
|
page;
|
|
24
22
|
limit;
|
|
25
23
|
}
|
|
@@ -43,15 +41,6 @@ __decorate([
|
|
|
43
41
|
(0, class_validator_1.IsEnum)(create_billing_dto_1.BILLING_STATUSES),
|
|
44
42
|
__metadata("design:type", String)
|
|
45
43
|
], ListBillingsQueryDto.prototype, "status", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
48
|
-
description: 'Payment ID filter (UUID)',
|
|
49
|
-
example: '550e8400-e29b-41d4-a716-446655440002',
|
|
50
|
-
}),
|
|
51
|
-
(0, class_validator_1.IsOptional)(),
|
|
52
|
-
(0, class_validator_1.IsUUID)('4'),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], ListBillingsQueryDto.prototype, "paymentId", void 0);
|
|
55
44
|
__decorate([
|
|
56
45
|
(0, swagger_1.ApiPropertyOptional)({
|
|
57
46
|
description: 'Filtro por método de pagamento associado à cobrança',
|
|
@@ -61,15 +50,6 @@ __decorate([
|
|
|
61
50
|
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.GATEWAY_PAYMENT_METHODS),
|
|
62
51
|
__metadata("design:type", String)
|
|
63
52
|
], ListBillingsQueryDto.prototype, "method", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
66
|
-
description: 'Filtro por gateway de pagamento',
|
|
67
|
-
enum: payment_gateway_enums_1.PAYMENT_GATEWAYS,
|
|
68
|
-
}),
|
|
69
|
-
(0, class_validator_1.IsOptional)(),
|
|
70
|
-
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.PAYMENT_GATEWAYS),
|
|
71
|
-
__metadata("design:type", String)
|
|
72
|
-
], ListBillingsQueryDto.prototype, "gateway", void 0);
|
|
73
53
|
__decorate([
|
|
74
54
|
(0, swagger_1.ApiPropertyOptional)({
|
|
75
55
|
description: 'Page number (starting at 1)',
|
|
@@ -140,7 +140,7 @@ describe('ConversationContactFiltersQueryConstraint', () => {
|
|
|
140
140
|
});
|
|
141
141
|
it('should reject a filter with invalid operator', async () => {
|
|
142
142
|
const raw = {
|
|
143
|
-
filters: '{"key":"intention","op":"
|
|
143
|
+
filters: '{"key":"intention","op":"contains","value":"x"}',
|
|
144
144
|
};
|
|
145
145
|
const dto = simulateValidationPipe(raw);
|
|
146
146
|
const errors = await (0, class_validator_1.validate)(dto, {
|
|
@@ -90,7 +90,7 @@ __decorate([
|
|
|
90
90
|
(0, swagger_1.ApiPropertyOptional)({
|
|
91
91
|
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
92
92
|
'Example: `[{"key":"followupType","op":"==","value":"abandonment"}]`. ' +
|
|
93
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
93
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
94
94
|
type: String,
|
|
95
95
|
example: '[{"key":"followupType","op":"==","value":"abandonment"}]',
|
|
96
96
|
}),
|
|
@@ -64,7 +64,7 @@ __decorate([
|
|
|
64
64
|
(0, swagger_1.ApiPropertyOptional)({
|
|
65
65
|
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
66
66
|
'Example: `[{"key":"intention","op":"==","value":"clinic_info"}]`. ' +
|
|
67
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
67
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (value must be string pattern for SQL LIKE).',
|
|
68
68
|
type: String,
|
|
69
69
|
example: '[{"key":"intention","op":"==","value":"clinic_info"}]',
|
|
70
70
|
}),
|
|
@@ -63,7 +63,7 @@ __decorate([
|
|
|
63
63
|
(0, swagger_1.ApiPropertyOptional)({
|
|
64
64
|
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
65
65
|
'Example: `[{"key":"conversationType","op":"==","value":"ia"}]`. ' +
|
|
66
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
66
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
67
67
|
type: String,
|
|
68
68
|
example: '[{"key":"intention","op":"==","value":"confirm_appointment"}]',
|
|
69
69
|
}),
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* - `>=` : Greater than or equal
|
|
9
9
|
* - `<=` : Less than or equal
|
|
10
10
|
* - `in` : Value is one of the elements in the array
|
|
11
|
+
* - `like` : SQL `LIKE` (value must be a string pattern, e.g. `%foo%`)
|
|
12
|
+
* - `unlike` : SQL `NOT LIKE` (value must be a string pattern)
|
|
11
13
|
*/
|
|
12
|
-
export declare const VALID_FILTER_OPS: readonly ["==", "!=", ">", "<", ">=", "<=", "in"];
|
|
14
|
+
export declare const VALID_FILTER_OPS: readonly ["==", "!=", ">", "<", ">=", "<=", "in", "like", "unlike"];
|
|
13
15
|
export type FilterOp = (typeof VALID_FILTER_OPS)[number];
|
|
14
16
|
/**
|
|
15
17
|
* Generic parsed filter object.
|
|
@@ -23,7 +25,7 @@ export interface ParsedFilterDto {
|
|
|
23
25
|
key: string;
|
|
24
26
|
/** Comparison operator. */
|
|
25
27
|
op: FilterOp;
|
|
26
|
-
/** Scalar value (string | number)
|
|
28
|
+
/** Scalar value (string | number), array for `in`, or string pattern for `like` / `unlike`. */
|
|
27
29
|
value: string | number | (string | number)[];
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=parsed-filter.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsed-filter.dto.d.ts","sourceRoot":"","sources":["../../src/filters/parsed-filter.dto.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parsed-filter.dto.d.ts","sourceRoot":"","sources":["../../src/filters/parsed-filter.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,qEAUnB,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,EAAE,EAAE,QAAQ,CAAC;IACb,+FAA+F;IAC/F,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC9C"}
|
|
@@ -11,6 +11,8 @@ exports.VALID_FILTER_OPS = void 0;
|
|
|
11
11
|
* - `>=` : Greater than or equal
|
|
12
12
|
* - `<=` : Less than or equal
|
|
13
13
|
* - `in` : Value is one of the elements in the array
|
|
14
|
+
* - `like` : SQL `LIKE` (value must be a string pattern, e.g. `%foo%`)
|
|
15
|
+
* - `unlike` : SQL `NOT LIKE` (value must be a string pattern)
|
|
14
16
|
*/
|
|
15
17
|
exports.VALID_FILTER_OPS = [
|
|
16
18
|
'==',
|
|
@@ -20,4 +22,6 @@ exports.VALID_FILTER_OPS = [
|
|
|
20
22
|
'>=',
|
|
21
23
|
'<=',
|
|
22
24
|
'in',
|
|
25
|
+
'like',
|
|
26
|
+
'unlike',
|
|
23
27
|
];
|
|
@@ -67,7 +67,7 @@ __decorate([
|
|
|
67
67
|
(0, swagger_1.ApiPropertyOptional)({
|
|
68
68
|
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
69
69
|
'Example: `[{"key":"cpf","op":"==","value":"12211117411"}]`. ' +
|
|
70
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
70
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
71
71
|
type: String,
|
|
72
72
|
example: '[{"key":"cpf","op":"==","value":"12211117411"}]',
|
|
73
73
|
}),
|
|
@@ -5,6 +5,7 @@ import { PaymentGatewayDto, GatewayPaymentMethodDto, GatewayPaymentStatusDto } f
|
|
|
5
5
|
export declare class ListGatewayPaymentsQueryDto {
|
|
6
6
|
tenantId?: string;
|
|
7
7
|
billingId?: string;
|
|
8
|
+
billingIds?: string[];
|
|
8
9
|
gateway?: PaymentGatewayDto;
|
|
9
10
|
method?: GatewayPaymentMethodDto;
|
|
10
11
|
status?: GatewayPaymentStatusDto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-gateway-payments-query.dto.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/list-gateway-payments-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,EAEjB,uBAAuB,EAEvB,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,qBAAa,2BAA2B;IAItC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"list-gateway-payments-query.dto.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/list-gateway-payments-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,EAEjB,uBAAuB,EAEvB,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,qBAAa,2BAA2B;IAItC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,SAAS,CAAC,EAAE,MAAM,CAAC;IAUnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAKtB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAK5B,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAKjC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAMjC,IAAI,CAAC,EAAE,MAAM,CAAC;IAOd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -19,6 +19,7 @@ const payment_gateway_enums_1 = require("./payment-gateway.enums");
|
|
|
19
19
|
class ListGatewayPaymentsQueryDto {
|
|
20
20
|
tenantId;
|
|
21
21
|
billingId;
|
|
22
|
+
billingIds;
|
|
22
23
|
gateway;
|
|
23
24
|
method;
|
|
24
25
|
status;
|
|
@@ -38,6 +39,17 @@ __decorate([
|
|
|
38
39
|
(0, class_validator_1.IsUUID)('4'),
|
|
39
40
|
__metadata("design:type", String)
|
|
40
41
|
], ListGatewayPaymentsQueryDto.prototype, "billingId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
44
|
+
description: 'Filtra por várias faturas (UUID). Ignorado se `billingId` estiver definido.',
|
|
45
|
+
type: [String],
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
(0, class_validator_1.IsArray)(),
|
|
49
|
+
(0, class_validator_1.ArrayMaxSize)(200),
|
|
50
|
+
(0, class_validator_1.IsUUID)('4', { each: true }),
|
|
51
|
+
__metadata("design:type", Array)
|
|
52
|
+
], ListGatewayPaymentsQueryDto.prototype, "billingIds", void 0);
|
|
41
53
|
__decorate([
|
|
42
54
|
(0, swagger_1.ApiPropertyOptional)({ description: 'Gateway filter', enum: payment_gateway_enums_1.PAYMENT_GATEWAYS }),
|
|
43
55
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -64,10 +76,10 @@ __decorate([
|
|
|
64
76
|
__metadata("design:type", Number)
|
|
65
77
|
], ListGatewayPaymentsQueryDto.prototype, "page", void 0);
|
|
66
78
|
__decorate([
|
|
67
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Records per page', example: 20, minimum: 1, maximum:
|
|
79
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'Records per page', example: 20, minimum: 1, maximum: 500, default: 20 }),
|
|
68
80
|
(0, class_validator_1.IsOptional)(),
|
|
69
81
|
(0, class_validator_1.IsInt)(),
|
|
70
82
|
(0, class_validator_1.Min)(1),
|
|
71
|
-
(0, class_validator_1.Max)(
|
|
83
|
+
(0, class_validator_1.Max)(500),
|
|
72
84
|
__metadata("design:type", Number)
|
|
73
85
|
], ListGatewayPaymentsQueryDto.prototype, "limit", void 0);
|
|
@@ -64,7 +64,7 @@ __decorate([
|
|
|
64
64
|
(0, swagger_1.ApiPropertyOptional)({
|
|
65
65
|
description: 'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
66
66
|
'Example: `[{"key":"specialtyId","op":"==","value":"550e8400-e29b-41d4-a716-446655440000"}]`. ' +
|
|
67
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`). ' +
|
|
67
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern). ' +
|
|
68
68
|
'Use key `sideEffects` for the `side_effects` column.',
|
|
69
69
|
type: String,
|
|
70
70
|
example: '[{"key":"name","op":"==","value":"Consulta"}]',
|
package/package.json
CHANGED
|
@@ -142,7 +142,7 @@ export class ListAppointmentsQueryDto {
|
|
|
142
142
|
description:
|
|
143
143
|
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
144
144
|
'Example: `[{"key":"status","op":"==","value":"pending"}]`. ' +
|
|
145
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
145
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
146
146
|
type: String,
|
|
147
147
|
example: '[{"key":"status","op":"==","value":"pending"}]',
|
|
148
148
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import { BillingLinkedPaymentDto } from './billing-linked-payment.dto';
|
|
4
|
+
import { BillingResponseDto } from './billing-response.dto';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Resposta de GET /billings/{id}: fatura + histórico de pagamentos no gateway.
|
|
8
|
+
*/
|
|
9
|
+
export class BillingDetailResponseDto extends BillingResponseDto {
|
|
10
|
+
@ApiProperty({
|
|
11
|
+
type: [BillingLinkedPaymentDto],
|
|
12
|
+
description:
|
|
13
|
+
'Todos os registros de pagamento no gateway para esta fatura (qualquer status), mais recentes primeiro.',
|
|
14
|
+
})
|
|
15
|
+
@Type(() => BillingLinkedPaymentDto)
|
|
16
|
+
payments!: BillingLinkedPaymentDto[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resumo de um pagamento no gateway vinculado a uma fatura (listagem).
|
|
5
|
+
* Sem `metadata` para evitar payload grande (PIX QR, etc.).
|
|
6
|
+
*/
|
|
7
|
+
export class BillingLinkedPaymentDto {
|
|
8
|
+
@ApiProperty({ description: 'ID do pagamento no gateway (UUID)' })
|
|
9
|
+
id: string;
|
|
10
|
+
|
|
11
|
+
@ApiProperty({ description: 'ID da fatura (UUID)' })
|
|
12
|
+
billingId: string;
|
|
13
|
+
|
|
14
|
+
@ApiProperty({ description: 'Valor cobrado' })
|
|
15
|
+
amount: number;
|
|
16
|
+
|
|
17
|
+
@ApiProperty({ description: 'PSP (ASAAS, MERCADO_PAGO, STRIPE)' })
|
|
18
|
+
gateway: string;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({ description: 'Meio (PIX, CREDIT_CARD, …)' })
|
|
21
|
+
method: string;
|
|
22
|
+
|
|
23
|
+
@ApiProperty({ description: 'Status no gateway' })
|
|
24
|
+
status: string;
|
|
25
|
+
|
|
26
|
+
@ApiPropertyOptional({ description: 'ID externo no PSP' })
|
|
27
|
+
externalId?: string | null;
|
|
28
|
+
|
|
29
|
+
@ApiPropertyOptional({ description: 'Data de confirmação/pagamento (ISO 8601)' })
|
|
30
|
+
paidAt?: string | null;
|
|
31
|
+
|
|
32
|
+
@ApiProperty({ description: 'Criação (ISO 8601)' })
|
|
33
|
+
createdAt: string;
|
|
34
|
+
|
|
35
|
+
@ApiProperty({ description: 'Atualização (ISO 8601)' })
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
}
|
package/src/billing/index.ts
CHANGED
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
GATEWAY_PAYMENT_METHODS,
|
|
9
9
|
type GatewayPaymentMethodDto,
|
|
10
|
-
PAYMENT_GATEWAYS,
|
|
11
|
-
type PaymentGatewayDto,
|
|
12
10
|
} from '../payment-gateway/payment-gateway.enums';
|
|
13
11
|
|
|
14
12
|
export class ListBillingsQueryDto {
|
|
@@ -29,14 +27,6 @@ export class ListBillingsQueryDto {
|
|
|
29
27
|
@IsEnum(BILLING_STATUSES)
|
|
30
28
|
status?: BillingStatusDto;
|
|
31
29
|
|
|
32
|
-
@ApiPropertyOptional({
|
|
33
|
-
description: 'Payment ID filter (UUID)',
|
|
34
|
-
example: '550e8400-e29b-41d4-a716-446655440002',
|
|
35
|
-
})
|
|
36
|
-
@IsOptional()
|
|
37
|
-
@IsUUID('4')
|
|
38
|
-
paymentId?: string;
|
|
39
|
-
|
|
40
30
|
@ApiPropertyOptional({
|
|
41
31
|
description: 'Filtro por método de pagamento associado à cobrança',
|
|
42
32
|
enum: GATEWAY_PAYMENT_METHODS,
|
|
@@ -45,14 +35,6 @@ export class ListBillingsQueryDto {
|
|
|
45
35
|
@IsEnum(GATEWAY_PAYMENT_METHODS)
|
|
46
36
|
method?: GatewayPaymentMethodDto;
|
|
47
37
|
|
|
48
|
-
@ApiPropertyOptional({
|
|
49
|
-
description: 'Filtro por gateway de pagamento',
|
|
50
|
-
enum: PAYMENT_GATEWAYS,
|
|
51
|
-
})
|
|
52
|
-
@IsOptional()
|
|
53
|
-
@IsEnum(PAYMENT_GATEWAYS)
|
|
54
|
-
gateway?: PaymentGatewayDto;
|
|
55
|
-
|
|
56
38
|
@ApiPropertyOptional({
|
|
57
39
|
description: 'Page number (starting at 1)',
|
|
58
40
|
example: 1,
|
|
@@ -153,7 +153,7 @@ describe('ConversationContactFiltersQueryConstraint', () => {
|
|
|
153
153
|
|
|
154
154
|
it('should reject a filter with invalid operator', async () => {
|
|
155
155
|
const raw = {
|
|
156
|
-
filters: '{"key":"intention","op":"
|
|
156
|
+
filters: '{"key":"intention","op":"contains","value":"x"}',
|
|
157
157
|
};
|
|
158
158
|
const dto = simulateValidationPipe(raw);
|
|
159
159
|
const errors = await validate(dto, {
|
|
@@ -77,7 +77,7 @@ export class FollowupLogListQueryDto {
|
|
|
77
77
|
description:
|
|
78
78
|
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
79
79
|
'Example: `[{"key":"followupType","op":"==","value":"abandonment"}]`. ' +
|
|
80
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
80
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
81
81
|
type: String,
|
|
82
82
|
example: '[{"key":"followupType","op":"==","value":"abandonment"}]',
|
|
83
83
|
})
|
|
@@ -50,7 +50,7 @@ export class ListConversationContactsQueryDto {
|
|
|
50
50
|
description:
|
|
51
51
|
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
52
52
|
'Example: `[{"key":"intention","op":"==","value":"clinic_info"}]`. ' +
|
|
53
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
53
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (value must be string pattern for SQL LIKE).',
|
|
54
54
|
type: String,
|
|
55
55
|
example: '[{"key":"intention","op":"==","value":"clinic_info"}]',
|
|
56
56
|
})
|
|
@@ -47,7 +47,7 @@ export class ListConversationSessionsQueryDto {
|
|
|
47
47
|
description:
|
|
48
48
|
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
49
49
|
'Example: `[{"key":"conversationType","op":"==","value":"ia"}]`. ' +
|
|
50
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
50
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
51
51
|
type: String,
|
|
52
52
|
example: '[{"key":"intention","op":"==","value":"confirm_appointment"}]',
|
|
53
53
|
})
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* - `>=` : Greater than or equal
|
|
9
9
|
* - `<=` : Less than or equal
|
|
10
10
|
* - `in` : Value is one of the elements in the array
|
|
11
|
+
* - `like` : SQL `LIKE` (value must be a string pattern, e.g. `%foo%`)
|
|
12
|
+
* - `unlike` : SQL `NOT LIKE` (value must be a string pattern)
|
|
11
13
|
*/
|
|
12
14
|
export const VALID_FILTER_OPS = [
|
|
13
15
|
'==',
|
|
@@ -17,6 +19,8 @@ export const VALID_FILTER_OPS = [
|
|
|
17
19
|
'>=',
|
|
18
20
|
'<=',
|
|
19
21
|
'in',
|
|
22
|
+
'like',
|
|
23
|
+
'unlike',
|
|
20
24
|
] as const;
|
|
21
25
|
export type FilterOp = (typeof VALID_FILTER_OPS)[number];
|
|
22
26
|
|
|
@@ -32,6 +36,6 @@ export interface ParsedFilterDto {
|
|
|
32
36
|
key: string;
|
|
33
37
|
/** Comparison operator. */
|
|
34
38
|
op: FilterOp;
|
|
35
|
-
/** Scalar value (string | number)
|
|
39
|
+
/** Scalar value (string | number), array for `in`, or string pattern for `like` / `unlike`. */
|
|
36
40
|
value: string | number | (string | number)[];
|
|
37
41
|
}
|
|
@@ -52,7 +52,7 @@ export class ListPatientsQueryDto {
|
|
|
52
52
|
description:
|
|
53
53
|
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
54
54
|
'Example: `[{"key":"cpf","op":"==","value":"12211117411"}]`. ' +
|
|
55
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`).',
|
|
55
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
56
56
|
type: String,
|
|
57
57
|
example: '[{"key":"cpf","op":"==","value":"12211117411"}]',
|
|
58
58
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { IsEnum, IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';
|
|
2
|
+
import { ArrayMaxSize, IsArray, IsEnum, IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';
|
|
3
3
|
import {
|
|
4
4
|
PAYMENT_GATEWAYS,
|
|
5
5
|
PaymentGatewayDto,
|
|
@@ -23,6 +23,16 @@ export class ListGatewayPaymentsQueryDto {
|
|
|
23
23
|
@IsUUID('4')
|
|
24
24
|
billingId?: string;
|
|
25
25
|
|
|
26
|
+
@ApiPropertyOptional({
|
|
27
|
+
description: 'Filtra por várias faturas (UUID). Ignorado se `billingId` estiver definido.',
|
|
28
|
+
type: [String],
|
|
29
|
+
})
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@IsArray()
|
|
32
|
+
@ArrayMaxSize(200)
|
|
33
|
+
@IsUUID('4', { each: true })
|
|
34
|
+
billingIds?: string[];
|
|
35
|
+
|
|
26
36
|
@ApiPropertyOptional({ description: 'Gateway filter', enum: PAYMENT_GATEWAYS })
|
|
27
37
|
@IsOptional()
|
|
28
38
|
@IsEnum(PAYMENT_GATEWAYS)
|
|
@@ -44,10 +54,10 @@ export class ListGatewayPaymentsQueryDto {
|
|
|
44
54
|
@Min(1)
|
|
45
55
|
page?: number;
|
|
46
56
|
|
|
47
|
-
@ApiPropertyOptional({ description: 'Records per page', example: 20, minimum: 1, maximum:
|
|
57
|
+
@ApiPropertyOptional({ description: 'Records per page', example: 20, minimum: 1, maximum: 500, default: 20 })
|
|
48
58
|
@IsOptional()
|
|
49
59
|
@IsInt()
|
|
50
60
|
@Min(1)
|
|
51
|
-
@Max(
|
|
61
|
+
@Max(500)
|
|
52
62
|
limit?: number;
|
|
53
63
|
}
|
|
@@ -49,7 +49,7 @@ export class ListProceduresQueryDto {
|
|
|
49
49
|
description:
|
|
50
50
|
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
51
51
|
'Example: `[{"key":"specialtyId","op":"==","value":"550e8400-e29b-41d4-a716-446655440000"}]`. ' +
|
|
52
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`). ' +
|
|
52
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern). ' +
|
|
53
53
|
'Use key `sideEffects` for the `side_effects` column.',
|
|
54
54
|
type: String,
|
|
55
55
|
example: '[{"key":"name","op":"==","value":"Consulta"}]',
|