tychat-contracts 1.6.21 → 1.6.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -33
- package/dist/storage/delete-object-rpc.dto.d.ts +9 -0
- package/dist/storage/delete-object-rpc.dto.d.ts.map +1 -0
- package/dist/storage/delete-object-rpc.dto.js +48 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -0
- package/dist/storage/storage-rmq-patterns.d.ts +2 -0
- package/dist/storage/storage-rmq-patterns.d.ts.map +1 -1
- package/dist/storage/storage-rmq-patterns.js +3 -1
- package/jest.config.ts +5 -5
- package/package.json +2 -1
- package/src/ai/ai-usage-response.dto.ts +47 -47
- package/src/ai/create-ai-usage.dto.ts +43 -43
- package/src/analytics/analytics-emitter.helper.ts +54 -54
- package/src/analytics/analytics-query.dto.ts +222 -222
- package/src/analytics/create-analytic-event.dto.ts +85 -85
- package/src/analytics/event-analytic.enum.ts +119 -119
- package/src/appointments/appointment-procedure.dto.ts +76 -76
- package/src/appointments/create-appointment.dto.ts +153 -153
- package/src/appointments/index.ts +10 -10
- package/src/appointments/list-appointments-query.dto.ts +157 -157
- package/src/appointments/update-appointment-procedure.dto.ts +10 -10
- package/src/appointments/update-appointment.dto.ts +4 -4
- package/src/auth/refresh-token.dto.ts +10 -10
- package/src/billing/billing-response.dto.ts +68 -68
- package/src/billing/create-billing.dto.ts +70 -70
- package/src/billing/index.ts +6 -6
- package/src/billing/list-billings-query.dto.ts +61 -61
- package/src/billing/update-billing.dto.ts +4 -4
- package/src/cashback/cashback-balance-response.dto.ts +33 -33
- package/src/cashback/cashback-config-response.dto.ts +43 -43
- package/src/cashback/cashback-enums.ts +33 -33
- package/src/cashback/cashback-kafka-payloads.ts +102 -102
- package/src/cashback/cashback-kafka-topics.ts +23 -23
- package/src/cashback/index.ts +7 -7
- package/src/cashback/referral-code-response.dto.ts +49 -49
- package/src/cashback/use-referral-code-response.dto.ts +15 -15
- package/src/configurations/clinic-configuration.dto.ts +39 -39
- package/src/configurations/opening-hours-slot.dto.ts +41 -41
- package/src/configurations/update-clinic-configuration.dto.ts +39 -39
- package/src/connections/whatsapp-official.dto.ts +113 -113
- package/src/conversations/conversation-contact-filters-query.validator.spec.ts +221 -221
- package/src/conversations/conversation-contact-filters-query.validator.ts +10 -10
- package/src/conversations/conversation-intention.dto.ts +24 -24
- package/src/conversations/conversation-response.dto.ts +69 -69
- package/src/conversations/conversation-session-response.dto.ts +65 -65
- package/src/conversations/conversation-type.dto.ts +15 -15
- package/src/conversations/create-conversation-session.dto.ts +28 -28
- package/src/conversations/create-conversation.dto.ts +69 -69
- package/src/conversations/followup-config-response.dto.ts +290 -290
- package/src/conversations/followup-log-response.dto.ts +58 -58
- package/src/conversations/followup-type.dto.ts +22 -22
- package/src/conversations/index.ts +17 -17
- package/src/conversations/list-conversation-contacts-filters.dto.ts +15 -15
- package/src/conversations/list-conversation-contacts-query.dto.ts +81 -81
- package/src/conversations/satisfaction-response.dto.ts +116 -116
- package/src/filters/index.ts +1 -1
- package/src/filters/parsed-filter.dto.ts +41 -41
- package/src/index.ts +23 -23
- package/src/patients/create-patient.dto.ts +122 -122
- package/src/patients/index.ts +10 -10
- package/src/patients/list-patients-filters.dto.ts +15 -15
- package/src/patients/list-patients-query.dto.ts +61 -61
- package/src/patients/patient-document-response.dto.ts +33 -33
- package/src/patients/patient-history-entry.dto.ts +22 -22
- package/src/patients/patient-status.dto.ts +9 -9
- package/src/patients/update-patient-document.dto.ts +10 -10
- package/src/patients/update-patient.dto.ts +15 -15
- package/src/payment-gateway/create-gateway-payment.dto.ts +123 -123
- package/src/payment-gateway/gateway-payment-response.dto.ts +65 -65
- package/src/payment-gateway/index.ts +12 -12
- package/src/payment-gateway/list-gateway-payments-query.dto.ts +63 -63
- package/src/payment-gateway/payment-gateway-kafka-topics.ts +25 -25
- package/src/payment-gateway/payment-gateway.enums.ts +34 -34
- package/src/payment-gateway/update-gateway-payment.dto.ts +7 -7
- package/src/payment-gateway/webhook-payload.dto.ts +32 -32
- package/src/payments/create-payment.dto.ts +73 -73
- package/src/payments/index.ts +6 -6
- package/src/payments/list-payments-query.dto.ts +44 -44
- package/src/payments/payment-response.dto.ts +67 -67
- package/src/payments/update-payment.dto.ts +4 -4
- package/src/procedures/create-procedure.dto.ts +104 -104
- package/src/procedures/index.ts +6 -6
- package/src/procedures/list-procedures-query.dto.ts +59 -59
- package/src/procedures/update-procedure.dto.ts +4 -4
- package/src/storage/delete-object-rpc.dto.ts +28 -0
- package/src/storage/index.ts +1 -0
- package/src/storage/storage-rmq-patterns.ts +3 -0
- package/src/tenants/index.ts +10 -10
- package/src/tenants/whatsapp-provider-kind.dto.ts +12 -12
- package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts +0 -7
- package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts.map +0 -1
- package/dist/analytics/should-skip-analytics-tenant-lookup.js +0 -13
- package/dist/appointments/opening-hours-slot.dto.d.ts +0 -6
- package/dist/appointments/opening-hours-slot.dto.d.ts.map +0 -1
- package/dist/appointments/opening-hours-slot.dto.js +0 -2
- package/dist/patients/patient-procedure.dto.d.ts +0 -9
- package/dist/patients/patient-procedure.dto.d.ts.map +0 -1
- package/dist/patients/patient-procedure.dto.js +0 -79
- package/dist/patients/update-patient-procedure.dto.d.ts +0 -6
- package/dist/patients/update-patient-procedure.dto.d.ts.map +0 -1
- package/dist/patients/update-patient-procedure.dto.js +0 -8
- package/dist/payments/payment.dto.d.ts +0 -15
- package/dist/payments/payment.dto.d.ts.map +0 -1
- package/dist/payments/payment.dto.js +0 -2
- package/dist/tenants/create-tenant.dto.d.ts +0 -10
- package/dist/tenants/create-tenant.dto.d.ts.map +0 -1
- package/dist/tenants/create-tenant.dto.js +0 -73
- package/dist/tenants/tenant-slug.util.spec.d.ts +0 -2
- package/dist/tenants/tenant-slug.util.spec.d.ts.map +0 -1
- package/dist/tenants/tenant-slug.util.spec.js +0 -102
- package/dist/tenants/update-tenant-payload.dto.d.ts +0 -6
- package/dist/tenants/update-tenant-payload.dto.d.ts.map +0 -1
- package/dist/tenants/update-tenant-payload.dto.js +0 -25
- package/dist/tenants/update-tenant.dto.d.ts +0 -10
- package/dist/tenants/update-tenant.dto.d.ts.map +0 -1
- package/dist/tenants/update-tenant.dto.js +0 -78
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsString, MinLength } from 'class-validator';
|
|
3
|
-
|
|
4
|
-
export class RefreshTokenDto {
|
|
5
|
-
@ApiProperty({ description: 'Token de refresh JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
|
|
6
|
-
@IsString()
|
|
7
|
-
@MinLength(1, { message: 'refresh_token não pode ser vazio' })
|
|
8
|
-
refresh_token: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class RefreshTokenDto {
|
|
5
|
+
@ApiProperty({ description: 'Token de refresh JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
|
|
6
|
+
@IsString()
|
|
7
|
+
@MinLength(1, { message: 'refresh_token não pode ser vazio' })
|
|
8
|
+
refresh_token: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
BILLING_STATUSES,
|
|
4
|
-
BillingStatusDto,
|
|
5
|
-
} from './create-billing.dto';
|
|
6
|
-
|
|
7
|
-
export class BillingResponseDto {
|
|
8
|
-
@ApiProperty({
|
|
9
|
-
description: 'Billing ID (UUID)',
|
|
10
|
-
example: '550e8400-e29b-41d4-a716-446655440111',
|
|
11
|
-
})
|
|
12
|
-
id: string;
|
|
13
|
-
|
|
14
|
-
@ApiProperty({
|
|
15
|
-
description: 'Tenant ID (UUID)',
|
|
16
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
17
|
-
})
|
|
18
|
-
tenantId: string;
|
|
19
|
-
|
|
20
|
-
@ApiProperty({
|
|
21
|
-
description: 'Billing value',
|
|
22
|
-
example: 99.9,
|
|
23
|
-
})
|
|
24
|
-
value: number;
|
|
25
|
-
|
|
26
|
-
@ApiProperty({
|
|
27
|
-
description: 'Billing status',
|
|
28
|
-
enum: BILLING_STATUSES,
|
|
29
|
-
example: 'PENDING',
|
|
30
|
-
})
|
|
31
|
-
status: BillingStatusDto;
|
|
32
|
-
|
|
33
|
-
@ApiPropertyOptional({
|
|
34
|
-
description: 'Payment ID from payment-gateway service (UUID)',
|
|
35
|
-
example: '550e8400-e29b-41d4-a716-446655440002',
|
|
36
|
-
})
|
|
37
|
-
paymentId?: string | null;
|
|
38
|
-
|
|
39
|
-
@ApiProperty({
|
|
40
|
-
description: 'Due date (ISO 8601)',
|
|
41
|
-
example: '2026-04-15T00:00:00.000Z',
|
|
42
|
-
})
|
|
43
|
-
dueDate: string;
|
|
44
|
-
|
|
45
|
-
@ApiPropertyOptional({
|
|
46
|
-
description: 'Date when billing was paid (ISO 8601)',
|
|
47
|
-
example: '2026-04-14T10:00:00.000Z',
|
|
48
|
-
})
|
|
49
|
-
payedAt?: string | null;
|
|
50
|
-
|
|
51
|
-
@ApiProperty({
|
|
52
|
-
description: 'Creation timestamp (ISO 8601)',
|
|
53
|
-
example: '2026-03-14T12:00:00.000Z',
|
|
54
|
-
})
|
|
55
|
-
createdAt: string;
|
|
56
|
-
|
|
57
|
-
@ApiProperty({
|
|
58
|
-
description: 'Last update timestamp (ISO 8601)',
|
|
59
|
-
example: '2026-03-14T12:00:00.000Z',
|
|
60
|
-
})
|
|
61
|
-
updatedAt: string;
|
|
62
|
-
|
|
63
|
-
@ApiPropertyOptional({
|
|
64
|
-
description: 'Soft deletion timestamp (ISO 8601)',
|
|
65
|
-
example: null,
|
|
66
|
-
})
|
|
67
|
-
deletedAt?: string | null;
|
|
68
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import {
|
|
3
|
+
BILLING_STATUSES,
|
|
4
|
+
BillingStatusDto,
|
|
5
|
+
} from './create-billing.dto';
|
|
6
|
+
|
|
7
|
+
export class BillingResponseDto {
|
|
8
|
+
@ApiProperty({
|
|
9
|
+
description: 'Billing ID (UUID)',
|
|
10
|
+
example: '550e8400-e29b-41d4-a716-446655440111',
|
|
11
|
+
})
|
|
12
|
+
id: string;
|
|
13
|
+
|
|
14
|
+
@ApiProperty({
|
|
15
|
+
description: 'Tenant ID (UUID)',
|
|
16
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
17
|
+
})
|
|
18
|
+
tenantId: string;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({
|
|
21
|
+
description: 'Billing value',
|
|
22
|
+
example: 99.9,
|
|
23
|
+
})
|
|
24
|
+
value: number;
|
|
25
|
+
|
|
26
|
+
@ApiProperty({
|
|
27
|
+
description: 'Billing status',
|
|
28
|
+
enum: BILLING_STATUSES,
|
|
29
|
+
example: 'PENDING',
|
|
30
|
+
})
|
|
31
|
+
status: BillingStatusDto;
|
|
32
|
+
|
|
33
|
+
@ApiPropertyOptional({
|
|
34
|
+
description: 'Payment ID from payment-gateway service (UUID)',
|
|
35
|
+
example: '550e8400-e29b-41d4-a716-446655440002',
|
|
36
|
+
})
|
|
37
|
+
paymentId?: string | null;
|
|
38
|
+
|
|
39
|
+
@ApiProperty({
|
|
40
|
+
description: 'Due date (ISO 8601)',
|
|
41
|
+
example: '2026-04-15T00:00:00.000Z',
|
|
42
|
+
})
|
|
43
|
+
dueDate: string;
|
|
44
|
+
|
|
45
|
+
@ApiPropertyOptional({
|
|
46
|
+
description: 'Date when billing was paid (ISO 8601)',
|
|
47
|
+
example: '2026-04-14T10:00:00.000Z',
|
|
48
|
+
})
|
|
49
|
+
payedAt?: string | null;
|
|
50
|
+
|
|
51
|
+
@ApiProperty({
|
|
52
|
+
description: 'Creation timestamp (ISO 8601)',
|
|
53
|
+
example: '2026-03-14T12:00:00.000Z',
|
|
54
|
+
})
|
|
55
|
+
createdAt: string;
|
|
56
|
+
|
|
57
|
+
@ApiProperty({
|
|
58
|
+
description: 'Last update timestamp (ISO 8601)',
|
|
59
|
+
example: '2026-03-14T12:00:00.000Z',
|
|
60
|
+
})
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
|
|
63
|
+
@ApiPropertyOptional({
|
|
64
|
+
description: 'Soft deletion timestamp (ISO 8601)',
|
|
65
|
+
example: null,
|
|
66
|
+
})
|
|
67
|
+
deletedAt?: string | null;
|
|
68
|
+
}
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
IsDateString,
|
|
4
|
-
IsEnum,
|
|
5
|
-
IsNotEmpty,
|
|
6
|
-
IsNumber,
|
|
7
|
-
IsOptional,
|
|
8
|
-
IsUUID,
|
|
9
|
-
Min,
|
|
10
|
-
} from 'class-validator';
|
|
11
|
-
|
|
12
|
-
export const BILLING_STATUSES = [
|
|
13
|
-
'PENDING',
|
|
14
|
-
'PAYED',
|
|
15
|
-
'REFUNDED',
|
|
16
|
-
'CANCELED',
|
|
17
|
-
'OVERDUE',
|
|
18
|
-
] as const;
|
|
19
|
-
export type BillingStatusDto = (typeof BILLING_STATUSES)[number];
|
|
20
|
-
|
|
21
|
-
export class CreateBillingDto {
|
|
22
|
-
@ApiProperty({
|
|
23
|
-
description: 'Tenant ID (UUID)',
|
|
24
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
25
|
-
})
|
|
26
|
-
@IsUUID('4')
|
|
27
|
-
@IsNotEmpty()
|
|
28
|
-
tenantId: string;
|
|
29
|
-
|
|
30
|
-
@ApiProperty({
|
|
31
|
-
description: 'Billing value',
|
|
32
|
-
example: 99.9,
|
|
33
|
-
minimum: 0.01,
|
|
34
|
-
})
|
|
35
|
-
@IsNumber()
|
|
36
|
-
@Min(0.01)
|
|
37
|
-
value: number;
|
|
38
|
-
|
|
39
|
-
@ApiPropertyOptional({
|
|
40
|
-
description: 'Billing status',
|
|
41
|
-
enum: BILLING_STATUSES,
|
|
42
|
-
default: 'PENDING',
|
|
43
|
-
})
|
|
44
|
-
@IsOptional()
|
|
45
|
-
@IsEnum(BILLING_STATUSES)
|
|
46
|
-
status?: BillingStatusDto;
|
|
47
|
-
|
|
48
|
-
@ApiPropertyOptional({
|
|
49
|
-
description: 'Payment ID from payment-gateway service (UUID)',
|
|
50
|
-
example: '550e8400-e29b-41d4-a716-446655440002',
|
|
51
|
-
})
|
|
52
|
-
@IsOptional()
|
|
53
|
-
@IsUUID('4')
|
|
54
|
-
paymentId?: string;
|
|
55
|
-
|
|
56
|
-
@ApiProperty({
|
|
57
|
-
description: 'Due date (ISO 8601)',
|
|
58
|
-
example: '2026-04-15T00:00:00.000Z',
|
|
59
|
-
})
|
|
60
|
-
@IsDateString()
|
|
61
|
-
dueDate: string;
|
|
62
|
-
|
|
63
|
-
@ApiPropertyOptional({
|
|
64
|
-
description: 'Date when billing was paid (ISO 8601)',
|
|
65
|
-
example: '2026-04-14T10:00:00.000Z',
|
|
66
|
-
})
|
|
67
|
-
@IsOptional()
|
|
68
|
-
@IsDateString()
|
|
69
|
-
payedAt?: string;
|
|
70
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import {
|
|
3
|
+
IsDateString,
|
|
4
|
+
IsEnum,
|
|
5
|
+
IsNotEmpty,
|
|
6
|
+
IsNumber,
|
|
7
|
+
IsOptional,
|
|
8
|
+
IsUUID,
|
|
9
|
+
Min,
|
|
10
|
+
} from 'class-validator';
|
|
11
|
+
|
|
12
|
+
export const BILLING_STATUSES = [
|
|
13
|
+
'PENDING',
|
|
14
|
+
'PAYED',
|
|
15
|
+
'REFUNDED',
|
|
16
|
+
'CANCELED',
|
|
17
|
+
'OVERDUE',
|
|
18
|
+
] as const;
|
|
19
|
+
export type BillingStatusDto = (typeof BILLING_STATUSES)[number];
|
|
20
|
+
|
|
21
|
+
export class CreateBillingDto {
|
|
22
|
+
@ApiProperty({
|
|
23
|
+
description: 'Tenant ID (UUID)',
|
|
24
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
25
|
+
})
|
|
26
|
+
@IsUUID('4')
|
|
27
|
+
@IsNotEmpty()
|
|
28
|
+
tenantId: string;
|
|
29
|
+
|
|
30
|
+
@ApiProperty({
|
|
31
|
+
description: 'Billing value',
|
|
32
|
+
example: 99.9,
|
|
33
|
+
minimum: 0.01,
|
|
34
|
+
})
|
|
35
|
+
@IsNumber()
|
|
36
|
+
@Min(0.01)
|
|
37
|
+
value: number;
|
|
38
|
+
|
|
39
|
+
@ApiPropertyOptional({
|
|
40
|
+
description: 'Billing status',
|
|
41
|
+
enum: BILLING_STATUSES,
|
|
42
|
+
default: 'PENDING',
|
|
43
|
+
})
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsEnum(BILLING_STATUSES)
|
|
46
|
+
status?: BillingStatusDto;
|
|
47
|
+
|
|
48
|
+
@ApiPropertyOptional({
|
|
49
|
+
description: 'Payment ID from payment-gateway service (UUID)',
|
|
50
|
+
example: '550e8400-e29b-41d4-a716-446655440002',
|
|
51
|
+
})
|
|
52
|
+
@IsOptional()
|
|
53
|
+
@IsUUID('4')
|
|
54
|
+
paymentId?: string;
|
|
55
|
+
|
|
56
|
+
@ApiProperty({
|
|
57
|
+
description: 'Due date (ISO 8601)',
|
|
58
|
+
example: '2026-04-15T00:00:00.000Z',
|
|
59
|
+
})
|
|
60
|
+
@IsDateString()
|
|
61
|
+
dueDate: string;
|
|
62
|
+
|
|
63
|
+
@ApiPropertyOptional({
|
|
64
|
+
description: 'Date when billing was paid (ISO 8601)',
|
|
65
|
+
example: '2026-04-14T10:00:00.000Z',
|
|
66
|
+
})
|
|
67
|
+
@IsOptional()
|
|
68
|
+
@IsDateString()
|
|
69
|
+
payedAt?: string;
|
|
70
|
+
}
|
package/src/billing/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './create-billing.dto';
|
|
2
|
-
export * from './update-billing.dto';
|
|
3
|
-
export * from './list-billings-query.dto';
|
|
4
|
-
export * from './billing-linked-payment.dto';
|
|
5
|
-
export * from './billing-response.dto';
|
|
6
|
-
export * from './billing-detail-response.dto';
|
|
1
|
+
export * from './create-billing.dto';
|
|
2
|
+
export * from './update-billing.dto';
|
|
3
|
+
export * from './list-billings-query.dto';
|
|
4
|
+
export * from './billing-linked-payment.dto';
|
|
5
|
+
export * from './billing-response.dto';
|
|
6
|
+
export * from './billing-detail-response.dto';
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { IsEnum, IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';
|
|
3
|
-
import {
|
|
4
|
-
BILLING_STATUSES,
|
|
5
|
-
BillingStatusDto,
|
|
6
|
-
} from './create-billing.dto';
|
|
7
|
-
import {
|
|
8
|
-
GATEWAY_PAYMENT_METHODS,
|
|
9
|
-
type GatewayPaymentMethodDto,
|
|
10
|
-
} from '../payment-gateway/payment-gateway.enums';
|
|
11
|
-
|
|
12
|
-
export class ListBillingsQueryDto {
|
|
13
|
-
@ApiPropertyOptional({
|
|
14
|
-
description: 'Tenant ID filter (UUID)',
|
|
15
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
16
|
-
})
|
|
17
|
-
@IsOptional()
|
|
18
|
-
@IsUUID('4')
|
|
19
|
-
tenantId?: string;
|
|
20
|
-
|
|
21
|
-
@ApiPropertyOptional({
|
|
22
|
-
description: 'Billing status filter',
|
|
23
|
-
enum: BILLING_STATUSES,
|
|
24
|
-
example: 'PENDING',
|
|
25
|
-
})
|
|
26
|
-
@IsOptional()
|
|
27
|
-
@IsEnum(BILLING_STATUSES)
|
|
28
|
-
status?: BillingStatusDto;
|
|
29
|
-
|
|
30
|
-
@ApiPropertyOptional({
|
|
31
|
-
description: 'Filtro por método de pagamento associado à cobrança',
|
|
32
|
-
enum: GATEWAY_PAYMENT_METHODS,
|
|
33
|
-
})
|
|
34
|
-
@IsOptional()
|
|
35
|
-
@IsEnum(GATEWAY_PAYMENT_METHODS)
|
|
36
|
-
method?: GatewayPaymentMethodDto;
|
|
37
|
-
|
|
38
|
-
@ApiPropertyOptional({
|
|
39
|
-
description: 'Page number (starting at 1)',
|
|
40
|
-
example: 1,
|
|
41
|
-
minimum: 1,
|
|
42
|
-
default: 1,
|
|
43
|
-
})
|
|
44
|
-
@IsOptional()
|
|
45
|
-
@IsInt()
|
|
46
|
-
@Min(1)
|
|
47
|
-
page?: number;
|
|
48
|
-
|
|
49
|
-
@ApiPropertyOptional({
|
|
50
|
-
description: 'Number of records per page',
|
|
51
|
-
example: 20,
|
|
52
|
-
minimum: 1,
|
|
53
|
-
maximum: 100,
|
|
54
|
-
default: 20,
|
|
55
|
-
})
|
|
56
|
-
@IsOptional()
|
|
57
|
-
@IsInt()
|
|
58
|
-
@Min(1)
|
|
59
|
-
@Max(100)
|
|
60
|
-
limit?: number;
|
|
61
|
-
}
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsEnum, IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';
|
|
3
|
+
import {
|
|
4
|
+
BILLING_STATUSES,
|
|
5
|
+
BillingStatusDto,
|
|
6
|
+
} from './create-billing.dto';
|
|
7
|
+
import {
|
|
8
|
+
GATEWAY_PAYMENT_METHODS,
|
|
9
|
+
type GatewayPaymentMethodDto,
|
|
10
|
+
} from '../payment-gateway/payment-gateway.enums';
|
|
11
|
+
|
|
12
|
+
export class ListBillingsQueryDto {
|
|
13
|
+
@ApiPropertyOptional({
|
|
14
|
+
description: 'Tenant ID filter (UUID)',
|
|
15
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
16
|
+
})
|
|
17
|
+
@IsOptional()
|
|
18
|
+
@IsUUID('4')
|
|
19
|
+
tenantId?: string;
|
|
20
|
+
|
|
21
|
+
@ApiPropertyOptional({
|
|
22
|
+
description: 'Billing status filter',
|
|
23
|
+
enum: BILLING_STATUSES,
|
|
24
|
+
example: 'PENDING',
|
|
25
|
+
})
|
|
26
|
+
@IsOptional()
|
|
27
|
+
@IsEnum(BILLING_STATUSES)
|
|
28
|
+
status?: BillingStatusDto;
|
|
29
|
+
|
|
30
|
+
@ApiPropertyOptional({
|
|
31
|
+
description: 'Filtro por método de pagamento associado à cobrança',
|
|
32
|
+
enum: GATEWAY_PAYMENT_METHODS,
|
|
33
|
+
})
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsEnum(GATEWAY_PAYMENT_METHODS)
|
|
36
|
+
method?: GatewayPaymentMethodDto;
|
|
37
|
+
|
|
38
|
+
@ApiPropertyOptional({
|
|
39
|
+
description: 'Page number (starting at 1)',
|
|
40
|
+
example: 1,
|
|
41
|
+
minimum: 1,
|
|
42
|
+
default: 1,
|
|
43
|
+
})
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsInt()
|
|
46
|
+
@Min(1)
|
|
47
|
+
page?: number;
|
|
48
|
+
|
|
49
|
+
@ApiPropertyOptional({
|
|
50
|
+
description: 'Number of records per page',
|
|
51
|
+
example: 20,
|
|
52
|
+
minimum: 1,
|
|
53
|
+
maximum: 100,
|
|
54
|
+
default: 20,
|
|
55
|
+
})
|
|
56
|
+
@IsOptional()
|
|
57
|
+
@IsInt()
|
|
58
|
+
@Min(1)
|
|
59
|
+
@Max(100)
|
|
60
|
+
limit?: number;
|
|
61
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/swagger';
|
|
2
|
-
import { CreateBillingDto } from './create-billing.dto';
|
|
3
|
-
|
|
4
|
-
export class UpdateBillingDto extends PartialType(CreateBillingDto) {}
|
|
1
|
+
import { PartialType } from '@nestjs/swagger';
|
|
2
|
+
import { CreateBillingDto } from './create-billing.dto';
|
|
3
|
+
|
|
4
|
+
export class UpdateBillingDto extends PartialType(CreateBillingDto) {}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Response DTO for cashback balance
|
|
5
|
-
*/
|
|
6
|
-
export class CashbackBalanceResponseDto {
|
|
7
|
-
@ApiProperty({ description: 'Balance ID (UUID)' })
|
|
8
|
-
id: string;
|
|
9
|
-
|
|
10
|
-
@ApiProperty({ description: 'Patient ID' })
|
|
11
|
-
patientId: string;
|
|
12
|
-
|
|
13
|
-
@ApiProperty({ description: 'Available (usable) balance' })
|
|
14
|
-
availableBalance: number;
|
|
15
|
-
|
|
16
|
-
@ApiProperty({ description: 'Pending balance (future use)' })
|
|
17
|
-
pendingBalance: number;
|
|
18
|
-
|
|
19
|
-
@ApiProperty({ description: 'Lifetime total earned' })
|
|
20
|
-
totalEarned: number;
|
|
21
|
-
|
|
22
|
-
@ApiProperty({ description: 'Lifetime total used/redeemed' })
|
|
23
|
-
totalUsed: number;
|
|
24
|
-
|
|
25
|
-
@ApiProperty({ description: 'Lifetime total expired' })
|
|
26
|
-
totalExpired: number;
|
|
27
|
-
|
|
28
|
-
@ApiProperty({ description: 'Creation timestamp' })
|
|
29
|
-
createdAt: string;
|
|
30
|
-
|
|
31
|
-
@ApiProperty({ description: 'Last update timestamp' })
|
|
32
|
-
updatedAt: string;
|
|
33
|
-
}
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Response DTO for cashback balance
|
|
5
|
+
*/
|
|
6
|
+
export class CashbackBalanceResponseDto {
|
|
7
|
+
@ApiProperty({ description: 'Balance ID (UUID)' })
|
|
8
|
+
id: string;
|
|
9
|
+
|
|
10
|
+
@ApiProperty({ description: 'Patient ID' })
|
|
11
|
+
patientId: string;
|
|
12
|
+
|
|
13
|
+
@ApiProperty({ description: 'Available (usable) balance' })
|
|
14
|
+
availableBalance: number;
|
|
15
|
+
|
|
16
|
+
@ApiProperty({ description: 'Pending balance (future use)' })
|
|
17
|
+
pendingBalance: number;
|
|
18
|
+
|
|
19
|
+
@ApiProperty({ description: 'Lifetime total earned' })
|
|
20
|
+
totalEarned: number;
|
|
21
|
+
|
|
22
|
+
@ApiProperty({ description: 'Lifetime total used/redeemed' })
|
|
23
|
+
totalUsed: number;
|
|
24
|
+
|
|
25
|
+
@ApiProperty({ description: 'Lifetime total expired' })
|
|
26
|
+
totalExpired: number;
|
|
27
|
+
|
|
28
|
+
@ApiProperty({ description: 'Creation timestamp' })
|
|
29
|
+
createdAt: string;
|
|
30
|
+
|
|
31
|
+
@ApiProperty({ description: 'Last update timestamp' })
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { CashbackDiscountTypeDto, CashbackExpirationTypeDto } from './cashback-enums';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Response DTO for cashback configuration
|
|
6
|
-
*/
|
|
7
|
-
export class CashbackConfigResponseDto {
|
|
8
|
-
@ApiProperty({ description: 'Config ID (UUID)' })
|
|
9
|
-
id: string;
|
|
10
|
-
|
|
11
|
-
@ApiProperty({ description: 'Whether cashback system is active' })
|
|
12
|
-
isActive: boolean;
|
|
13
|
-
|
|
14
|
-
@ApiProperty({ description: 'Cashback percentage for referrer', example: 10.0 })
|
|
15
|
-
cashbackPercentage: number;
|
|
16
|
-
|
|
17
|
-
@ApiProperty({ description: 'Discount type for referred patient', enum: CashbackDiscountTypeDto })
|
|
18
|
-
discountType: CashbackDiscountTypeDto;
|
|
19
|
-
|
|
20
|
-
@ApiProperty({ description: 'Discount value', example: 10.0 })
|
|
21
|
-
discountValue: number;
|
|
22
|
-
|
|
23
|
-
@ApiProperty({ description: 'Expiration type', enum: CashbackExpirationTypeDto })
|
|
24
|
-
expirationType: CashbackExpirationTypeDto;
|
|
25
|
-
|
|
26
|
-
@ApiPropertyOptional({ description: 'Expiration days (PERIOD_PER_PATIENT)' })
|
|
27
|
-
expirationDays?: number | null;
|
|
28
|
-
|
|
29
|
-
@ApiPropertyOptional({ description: 'Max total uses (LIMITED)' })
|
|
30
|
-
maxTotalUses?: number | null;
|
|
31
|
-
|
|
32
|
-
@ApiPropertyOptional({ description: 'Max uses per patient (LIMITED)' })
|
|
33
|
-
maxUsesPerPatient?: number | null;
|
|
34
|
-
|
|
35
|
-
@ApiPropertyOptional({ description: 'Code expiration days (LIMITED)' })
|
|
36
|
-
codeExpirationDays?: number | null;
|
|
37
|
-
|
|
38
|
-
@ApiProperty({ description: 'Creation timestamp' })
|
|
39
|
-
createdAt: string;
|
|
40
|
-
|
|
41
|
-
@ApiProperty({ description: 'Last update timestamp' })
|
|
42
|
-
updatedAt: string;
|
|
43
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { CashbackDiscountTypeDto, CashbackExpirationTypeDto } from './cashback-enums';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Response DTO for cashback configuration
|
|
6
|
+
*/
|
|
7
|
+
export class CashbackConfigResponseDto {
|
|
8
|
+
@ApiProperty({ description: 'Config ID (UUID)' })
|
|
9
|
+
id: string;
|
|
10
|
+
|
|
11
|
+
@ApiProperty({ description: 'Whether cashback system is active' })
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
|
|
14
|
+
@ApiProperty({ description: 'Cashback percentage for referrer', example: 10.0 })
|
|
15
|
+
cashbackPercentage: number;
|
|
16
|
+
|
|
17
|
+
@ApiProperty({ description: 'Discount type for referred patient', enum: CashbackDiscountTypeDto })
|
|
18
|
+
discountType: CashbackDiscountTypeDto;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({ description: 'Discount value', example: 10.0 })
|
|
21
|
+
discountValue: number;
|
|
22
|
+
|
|
23
|
+
@ApiProperty({ description: 'Expiration type', enum: CashbackExpirationTypeDto })
|
|
24
|
+
expirationType: CashbackExpirationTypeDto;
|
|
25
|
+
|
|
26
|
+
@ApiPropertyOptional({ description: 'Expiration days (PERIOD_PER_PATIENT)' })
|
|
27
|
+
expirationDays?: number | null;
|
|
28
|
+
|
|
29
|
+
@ApiPropertyOptional({ description: 'Max total uses (LIMITED)' })
|
|
30
|
+
maxTotalUses?: number | null;
|
|
31
|
+
|
|
32
|
+
@ApiPropertyOptional({ description: 'Max uses per patient (LIMITED)' })
|
|
33
|
+
maxUsesPerPatient?: number | null;
|
|
34
|
+
|
|
35
|
+
@ApiPropertyOptional({ description: 'Code expiration days (LIMITED)' })
|
|
36
|
+
codeExpirationDays?: number | null;
|
|
37
|
+
|
|
38
|
+
@ApiProperty({ description: 'Creation timestamp' })
|
|
39
|
+
createdAt: string;
|
|
40
|
+
|
|
41
|
+
@ApiProperty({ description: 'Last update timestamp' })
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expiration type for referral codes
|
|
3
|
-
*/
|
|
4
|
-
export enum CashbackExpirationTypeDto {
|
|
5
|
-
/** Each referred patient can only use the code once */
|
|
6
|
-
SINGLE_USE_PER_PATIENT = 'SINGLE_USE_PER_PATIENT',
|
|
7
|
-
/** Code stays active for a limited period per patient */
|
|
8
|
-
PERIOD_PER_PATIENT = 'PERIOD_PER_PATIENT',
|
|
9
|
-
/** Code has total use limit and optional per-patient limit */
|
|
10
|
-
LIMITED = 'LIMITED',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Discount type for referred patients
|
|
15
|
-
*/
|
|
16
|
-
export enum CashbackDiscountTypeDto {
|
|
17
|
-
/** Discount is a percentage of the checkout amount */
|
|
18
|
-
PERCENTAGE = 'PERCENTAGE',
|
|
19
|
-
/** Discount is a fixed amount */
|
|
20
|
-
FIXED = 'FIXED',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Cashback ledger transaction type
|
|
25
|
-
*/
|
|
26
|
-
export enum CashbackLedgerTypeDto {
|
|
27
|
-
/** Cashback earned from referral */
|
|
28
|
-
CREDIT = 'CREDIT',
|
|
29
|
-
/** Cashback redeemed/used */
|
|
30
|
-
DEBIT = 'DEBIT',
|
|
31
|
-
/** Credits expired */
|
|
32
|
-
EXPIRATION = 'EXPIRATION',
|
|
33
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Expiration type for referral codes
|
|
3
|
+
*/
|
|
4
|
+
export enum CashbackExpirationTypeDto {
|
|
5
|
+
/** Each referred patient can only use the code once */
|
|
6
|
+
SINGLE_USE_PER_PATIENT = 'SINGLE_USE_PER_PATIENT',
|
|
7
|
+
/** Code stays active for a limited period per patient */
|
|
8
|
+
PERIOD_PER_PATIENT = 'PERIOD_PER_PATIENT',
|
|
9
|
+
/** Code has total use limit and optional per-patient limit */
|
|
10
|
+
LIMITED = 'LIMITED',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Discount type for referred patients
|
|
15
|
+
*/
|
|
16
|
+
export enum CashbackDiscountTypeDto {
|
|
17
|
+
/** Discount is a percentage of the checkout amount */
|
|
18
|
+
PERCENTAGE = 'PERCENTAGE',
|
|
19
|
+
/** Discount is a fixed amount */
|
|
20
|
+
FIXED = 'FIXED',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Cashback ledger transaction type
|
|
25
|
+
*/
|
|
26
|
+
export enum CashbackLedgerTypeDto {
|
|
27
|
+
/** Cashback earned from referral */
|
|
28
|
+
CREDIT = 'CREDIT',
|
|
29
|
+
/** Cashback redeemed/used */
|
|
30
|
+
DEBIT = 'DEBIT',
|
|
31
|
+
/** Credits expired */
|
|
32
|
+
EXPIRATION = 'EXPIRATION',
|
|
33
|
+
}
|