tychat-contracts 1.6.21 → 1.6.23
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,58 +1,58 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { IsIn, IsInt, IsNotEmpty, IsOptional, IsString, Max, Min } from 'class-validator';
|
|
3
|
-
import { FOLLOWUP_TYPES, FollowupTypeDto } from './followup-type.dto';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a follow-up attempt log entry.
|
|
7
|
-
* Tracks each follow-up message sent to a patient within a session or appointment.
|
|
8
|
-
*/
|
|
9
|
-
export class FollowupLogResponseDto {
|
|
10
|
-
@ApiProperty({ description: 'Log primary key (UUID)' })
|
|
11
|
-
@IsString()
|
|
12
|
-
@IsNotEmpty()
|
|
13
|
-
id: string;
|
|
14
|
-
|
|
15
|
-
@ApiPropertyOptional({ description: 'Session UUID from conversation_sessions (null for appointment-based)' })
|
|
16
|
-
@IsOptional()
|
|
17
|
-
@IsString()
|
|
18
|
-
sessionUuid?: string | null;
|
|
19
|
-
|
|
20
|
-
@ApiProperty({ description: 'Patient UUID' })
|
|
21
|
-
@IsString()
|
|
22
|
-
@IsNotEmpty()
|
|
23
|
-
patientId: string;
|
|
24
|
-
|
|
25
|
-
@ApiProperty({ description: 'Follow-up attempt number (1-5 for abandonment, 1 for appointment-based)', example: 1 })
|
|
26
|
-
@IsInt()
|
|
27
|
-
@Min(1)
|
|
28
|
-
@Max(5)
|
|
29
|
-
attempt: number;
|
|
30
|
-
|
|
31
|
-
@ApiProperty({ description: 'The follow-up message sent to the patient' })
|
|
32
|
-
@IsString()
|
|
33
|
-
@IsNotEmpty()
|
|
34
|
-
message: string;
|
|
35
|
-
|
|
36
|
-
@ApiPropertyOptional({ description: 'The intention detected at the time of follow-up' })
|
|
37
|
-
@IsOptional()
|
|
38
|
-
@IsString()
|
|
39
|
-
intention?: string;
|
|
40
|
-
|
|
41
|
-
@ApiProperty({
|
|
42
|
-
description: 'Type of follow-up',
|
|
43
|
-
enum: FOLLOWUP_TYPES,
|
|
44
|
-
example: 'abandonment',
|
|
45
|
-
})
|
|
46
|
-
@IsIn(FOLLOWUP_TYPES)
|
|
47
|
-
followupType: FollowupTypeDto;
|
|
48
|
-
|
|
49
|
-
@ApiPropertyOptional({ description: 'Appointment UUID (for appointment-based follow-ups)' })
|
|
50
|
-
@IsOptional()
|
|
51
|
-
@IsString()
|
|
52
|
-
appointmentId?: string | null;
|
|
53
|
-
|
|
54
|
-
@ApiProperty({ description: 'Timestamp when the follow-up was sent (ISO 8601)' })
|
|
55
|
-
@IsString()
|
|
56
|
-
@IsNotEmpty()
|
|
57
|
-
sentAt: string;
|
|
58
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsIn, IsInt, IsNotEmpty, IsOptional, IsString, Max, Min } from 'class-validator';
|
|
3
|
+
import { FOLLOWUP_TYPES, FollowupTypeDto } from './followup-type.dto';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a follow-up attempt log entry.
|
|
7
|
+
* Tracks each follow-up message sent to a patient within a session or appointment.
|
|
8
|
+
*/
|
|
9
|
+
export class FollowupLogResponseDto {
|
|
10
|
+
@ApiProperty({ description: 'Log primary key (UUID)' })
|
|
11
|
+
@IsString()
|
|
12
|
+
@IsNotEmpty()
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
@ApiPropertyOptional({ description: 'Session UUID from conversation_sessions (null for appointment-based)' })
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsString()
|
|
18
|
+
sessionUuid?: string | null;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({ description: 'Patient UUID' })
|
|
21
|
+
@IsString()
|
|
22
|
+
@IsNotEmpty()
|
|
23
|
+
patientId: string;
|
|
24
|
+
|
|
25
|
+
@ApiProperty({ description: 'Follow-up attempt number (1-5 for abandonment, 1 for appointment-based)', example: 1 })
|
|
26
|
+
@IsInt()
|
|
27
|
+
@Min(1)
|
|
28
|
+
@Max(5)
|
|
29
|
+
attempt: number;
|
|
30
|
+
|
|
31
|
+
@ApiProperty({ description: 'The follow-up message sent to the patient' })
|
|
32
|
+
@IsString()
|
|
33
|
+
@IsNotEmpty()
|
|
34
|
+
message: string;
|
|
35
|
+
|
|
36
|
+
@ApiPropertyOptional({ description: 'The intention detected at the time of follow-up' })
|
|
37
|
+
@IsOptional()
|
|
38
|
+
@IsString()
|
|
39
|
+
intention?: string;
|
|
40
|
+
|
|
41
|
+
@ApiProperty({
|
|
42
|
+
description: 'Type of follow-up',
|
|
43
|
+
enum: FOLLOWUP_TYPES,
|
|
44
|
+
example: 'abandonment',
|
|
45
|
+
})
|
|
46
|
+
@IsIn(FOLLOWUP_TYPES)
|
|
47
|
+
followupType: FollowupTypeDto;
|
|
48
|
+
|
|
49
|
+
@ApiPropertyOptional({ description: 'Appointment UUID (for appointment-based follow-ups)' })
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@IsString()
|
|
52
|
+
appointmentId?: string | null;
|
|
53
|
+
|
|
54
|
+
@ApiProperty({ description: 'Timestamp when the follow-up was sent (ISO 8601)' })
|
|
55
|
+
@IsString()
|
|
56
|
+
@IsNotEmpty()
|
|
57
|
+
sentAt: string;
|
|
58
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* All follow-up types supported by the follow-up service.
|
|
3
|
-
*
|
|
4
|
-
* - "abandonment" → Patient stopped responding during a conversation.
|
|
5
|
-
* - "appointment_confirmation" → Reminder sent before an upcoming appointment.
|
|
6
|
-
* - "satisfaction_booking" → Satisfaction survey after the patient books an appointment.
|
|
7
|
-
* - "satisfaction_finished" → Satisfaction survey after an appointment is marked as finished.
|
|
8
|
-
* - "no_show_reschedule" → Follow-up for patients who did not show up (no_show status).
|
|
9
|
-
* - "wellness_check" → Check on patient well-being after procedures (side effects).
|
|
10
|
-
* - "return_suggestion" → Suggest a return visit based on procedure return_days.
|
|
11
|
-
*/
|
|
12
|
-
export const FOLLOWUP_TYPES = [
|
|
13
|
-
'abandonment',
|
|
14
|
-
'appointment_confirmation',
|
|
15
|
-
'satisfaction_booking',
|
|
16
|
-
'satisfaction_finished',
|
|
17
|
-
'no_show_reschedule',
|
|
18
|
-
'wellness_check',
|
|
19
|
-
'return_suggestion',
|
|
20
|
-
] as const;
|
|
21
|
-
|
|
22
|
-
export type FollowupTypeDto = (typeof FOLLOWUP_TYPES)[number];
|
|
1
|
+
/**
|
|
2
|
+
* All follow-up types supported by the follow-up service.
|
|
3
|
+
*
|
|
4
|
+
* - "abandonment" → Patient stopped responding during a conversation.
|
|
5
|
+
* - "appointment_confirmation" → Reminder sent before an upcoming appointment.
|
|
6
|
+
* - "satisfaction_booking" → Satisfaction survey after the patient books an appointment.
|
|
7
|
+
* - "satisfaction_finished" → Satisfaction survey after an appointment is marked as finished.
|
|
8
|
+
* - "no_show_reschedule" → Follow-up for patients who did not show up (no_show status).
|
|
9
|
+
* - "wellness_check" → Check on patient well-being after procedures (side effects).
|
|
10
|
+
* - "return_suggestion" → Suggest a return visit based on procedure return_days.
|
|
11
|
+
*/
|
|
12
|
+
export const FOLLOWUP_TYPES = [
|
|
13
|
+
'abandonment',
|
|
14
|
+
'appointment_confirmation',
|
|
15
|
+
'satisfaction_booking',
|
|
16
|
+
'satisfaction_finished',
|
|
17
|
+
'no_show_reschedule',
|
|
18
|
+
'wellness_check',
|
|
19
|
+
'return_suggestion',
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
export type FollowupTypeDto = (typeof FOLLOWUP_TYPES)[number];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './conversation-type.dto';
|
|
2
|
-
export * from './conversation-intention.dto';
|
|
3
|
-
export * from './list-conversation-contacts-filters.dto';
|
|
4
|
-
export * from './conversation-contact-filters-query.validator';
|
|
5
|
-
export * from './list-conversation-contacts-query.dto';
|
|
6
|
-
export * from './list-conversation-sessions-query.dto';
|
|
7
|
-
export * from './create-conversation-session.dto';
|
|
8
|
-
export * from './conversation-session-response.dto';
|
|
9
|
-
export * from './create-conversation.dto';
|
|
10
|
-
export * from './conversation-response.dto';
|
|
11
|
-
export * from './followup-type.dto';
|
|
12
|
-
export * from './followup-config-response.dto';
|
|
13
|
-
export * from './followup-log-response.dto';
|
|
14
|
-
export * from './followup-log-list-query.dto';
|
|
15
|
-
export * from './followup-log-list-response.dto';
|
|
16
|
-
export * from './satisfaction-response.dto';
|
|
17
|
-
export * from './followup-events.dto';
|
|
1
|
+
export * from './conversation-type.dto';
|
|
2
|
+
export * from './conversation-intention.dto';
|
|
3
|
+
export * from './list-conversation-contacts-filters.dto';
|
|
4
|
+
export * from './conversation-contact-filters-query.validator';
|
|
5
|
+
export * from './list-conversation-contacts-query.dto';
|
|
6
|
+
export * from './list-conversation-sessions-query.dto';
|
|
7
|
+
export * from './create-conversation-session.dto';
|
|
8
|
+
export * from './conversation-session-response.dto';
|
|
9
|
+
export * from './create-conversation.dto';
|
|
10
|
+
export * from './conversation-response.dto';
|
|
11
|
+
export * from './followup-type.dto';
|
|
12
|
+
export * from './followup-config-response.dto';
|
|
13
|
+
export * from './followup-log-response.dto';
|
|
14
|
+
export * from './followup-log-list-query.dto';
|
|
15
|
+
export * from './followup-log-list-response.dto';
|
|
16
|
+
export * from './satisfaction-response.dto';
|
|
17
|
+
export * from './followup-events.dto';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-exports CONVERSATION_CONTACT_LIST_FILTER_KEYS from the query DTO
|
|
3
|
-
* for backward compatibility. The generic ParsedFilterDto from `../filters`
|
|
4
|
-
* is now the canonical filter shape used across all services.
|
|
5
|
-
*/
|
|
6
|
-
export {
|
|
7
|
-
CONVERSATION_CONTACT_LIST_FILTER_KEYS,
|
|
8
|
-
type ConversationContactListFilterKeyDto,
|
|
9
|
-
} from './list-conversation-contacts-query.dto';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `ParsedFilterDto` from `../filters` instead.
|
|
13
|
-
* Kept as an alias for backward compatibility during migration.
|
|
14
|
-
*/
|
|
15
|
-
export type { ParsedFilterDto as ConversationContactListFilterDto } from '../filters/parsed-filter.dto';
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports CONVERSATION_CONTACT_LIST_FILTER_KEYS from the query DTO
|
|
3
|
+
* for backward compatibility. The generic ParsedFilterDto from `../filters`
|
|
4
|
+
* is now the canonical filter shape used across all services.
|
|
5
|
+
*/
|
|
6
|
+
export {
|
|
7
|
+
CONVERSATION_CONTACT_LIST_FILTER_KEYS,
|
|
8
|
+
type ConversationContactListFilterKeyDto,
|
|
9
|
+
} from './list-conversation-contacts-query.dto';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `ParsedFilterDto` from `../filters` instead.
|
|
13
|
+
* Kept as an alias for backward compatibility during migration.
|
|
14
|
+
*/
|
|
15
|
+
export type { ParsedFilterDto as ConversationContactListFilterDto } from '../filters/parsed-filter.dto';
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { Transform } from 'class-transformer';
|
|
3
|
-
import { IsIn, IsInt, IsOptional, Max, Min } from 'class-validator';
|
|
4
|
-
import type { ParsedFilterDto } from '../filters/parsed-filter.dto';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Allowed conversation session entity columns for filtering (camelCase API keys).
|
|
8
|
-
* Microservice uses this whitelist to prevent access to non-existent columns.
|
|
9
|
-
*/
|
|
10
|
-
export const CONVERSATION_CONTACT_LIST_FILTER_KEYS = [
|
|
11
|
-
'id',
|
|
12
|
-
'sessionUuid',
|
|
13
|
-
'patientId',
|
|
14
|
-
'unitId',
|
|
15
|
-
'tenantEvogoInstanceId',
|
|
16
|
-
'conversationType',
|
|
17
|
-
'intention',
|
|
18
|
-
'unreadCount',
|
|
19
|
-
'startedAt',
|
|
20
|
-
'expiresAt',
|
|
21
|
-
] as const;
|
|
22
|
-
export type ConversationContactListFilterKeyDto =
|
|
23
|
-
(typeof CONVERSATION_CONTACT_LIST_FILTER_KEYS)[number];
|
|
24
|
-
|
|
25
|
-
export class ListConversationContactsQueryDto {
|
|
26
|
-
@ApiPropertyOptional({
|
|
27
|
-
description: 'Número da página (iniciando em 1)',
|
|
28
|
-
example: 1,
|
|
29
|
-
minimum: 1,
|
|
30
|
-
default: 1,
|
|
31
|
-
})
|
|
32
|
-
@IsOptional()
|
|
33
|
-
@IsInt()
|
|
34
|
-
@Min(1)
|
|
35
|
-
page?: number;
|
|
36
|
-
|
|
37
|
-
@ApiPropertyOptional({
|
|
38
|
-
description: 'Registros por página',
|
|
39
|
-
example: 20,
|
|
40
|
-
minimum: 1,
|
|
41
|
-
maximum: 100,
|
|
42
|
-
default: 20,
|
|
43
|
-
})
|
|
44
|
-
@IsOptional()
|
|
45
|
-
@IsInt()
|
|
46
|
-
@Min(1)
|
|
47
|
-
@Max(100)
|
|
48
|
-
limit?: number;
|
|
49
|
-
|
|
50
|
-
@ApiPropertyOptional({
|
|
51
|
-
description:
|
|
52
|
-
'Campo de ordenação: `startedAt` (padrão na API) ou `unreadCount`.',
|
|
53
|
-
enum: ['startedAt', 'unreadCount'],
|
|
54
|
-
})
|
|
55
|
-
@IsOptional()
|
|
56
|
-
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
|
57
|
-
@IsIn(['startedAt', 'unreadCount'])
|
|
58
|
-
sortBy?: 'startedAt' | 'unreadCount';
|
|
59
|
-
|
|
60
|
-
@ApiPropertyOptional({
|
|
61
|
-
description: 'Direção: `ASC` ou `DESC` (case-insensitive na query string).',
|
|
62
|
-
enum: ['ASC', 'DESC'],
|
|
63
|
-
})
|
|
64
|
-
@IsOptional()
|
|
65
|
-
@Transform(({ value }) =>
|
|
66
|
-
typeof value === 'string' ? value.trim().toUpperCase() : value,
|
|
67
|
-
)
|
|
68
|
-
@IsIn(['ASC', 'DESC'])
|
|
69
|
-
sortOrder?: 'ASC' | 'DESC';
|
|
70
|
-
|
|
71
|
-
@ApiPropertyOptional({
|
|
72
|
-
description:
|
|
73
|
-
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
74
|
-
'Example: `[{"key":"intention","op":"==","value":"clinic_info"}]`. ' +
|
|
75
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (value must be string pattern for SQL LIKE).',
|
|
76
|
-
type: String,
|
|
77
|
-
example: '[{"key":"intention","op":"==","value":"clinic_info"}]',
|
|
78
|
-
})
|
|
79
|
-
@IsOptional()
|
|
80
|
-
filters?: ParsedFilterDto[];
|
|
81
|
-
}
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Transform } from 'class-transformer';
|
|
3
|
+
import { IsIn, IsInt, IsOptional, Max, Min } from 'class-validator';
|
|
4
|
+
import type { ParsedFilterDto } from '../filters/parsed-filter.dto';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Allowed conversation session entity columns for filtering (camelCase API keys).
|
|
8
|
+
* Microservice uses this whitelist to prevent access to non-existent columns.
|
|
9
|
+
*/
|
|
10
|
+
export const CONVERSATION_CONTACT_LIST_FILTER_KEYS = [
|
|
11
|
+
'id',
|
|
12
|
+
'sessionUuid',
|
|
13
|
+
'patientId',
|
|
14
|
+
'unitId',
|
|
15
|
+
'tenantEvogoInstanceId',
|
|
16
|
+
'conversationType',
|
|
17
|
+
'intention',
|
|
18
|
+
'unreadCount',
|
|
19
|
+
'startedAt',
|
|
20
|
+
'expiresAt',
|
|
21
|
+
] as const;
|
|
22
|
+
export type ConversationContactListFilterKeyDto =
|
|
23
|
+
(typeof CONVERSATION_CONTACT_LIST_FILTER_KEYS)[number];
|
|
24
|
+
|
|
25
|
+
export class ListConversationContactsQueryDto {
|
|
26
|
+
@ApiPropertyOptional({
|
|
27
|
+
description: 'Número da página (iniciando em 1)',
|
|
28
|
+
example: 1,
|
|
29
|
+
minimum: 1,
|
|
30
|
+
default: 1,
|
|
31
|
+
})
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@IsInt()
|
|
34
|
+
@Min(1)
|
|
35
|
+
page?: number;
|
|
36
|
+
|
|
37
|
+
@ApiPropertyOptional({
|
|
38
|
+
description: 'Registros por página',
|
|
39
|
+
example: 20,
|
|
40
|
+
minimum: 1,
|
|
41
|
+
maximum: 100,
|
|
42
|
+
default: 20,
|
|
43
|
+
})
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsInt()
|
|
46
|
+
@Min(1)
|
|
47
|
+
@Max(100)
|
|
48
|
+
limit?: number;
|
|
49
|
+
|
|
50
|
+
@ApiPropertyOptional({
|
|
51
|
+
description:
|
|
52
|
+
'Campo de ordenação: `startedAt` (padrão na API) ou `unreadCount`.',
|
|
53
|
+
enum: ['startedAt', 'unreadCount'],
|
|
54
|
+
})
|
|
55
|
+
@IsOptional()
|
|
56
|
+
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
|
57
|
+
@IsIn(['startedAt', 'unreadCount'])
|
|
58
|
+
sortBy?: 'startedAt' | 'unreadCount';
|
|
59
|
+
|
|
60
|
+
@ApiPropertyOptional({
|
|
61
|
+
description: 'Direção: `ASC` ou `DESC` (case-insensitive na query string).',
|
|
62
|
+
enum: ['ASC', 'DESC'],
|
|
63
|
+
})
|
|
64
|
+
@IsOptional()
|
|
65
|
+
@Transform(({ value }) =>
|
|
66
|
+
typeof value === 'string' ? value.trim().toUpperCase() : value,
|
|
67
|
+
)
|
|
68
|
+
@IsIn(['ASC', 'DESC'])
|
|
69
|
+
sortOrder?: 'ASC' | 'DESC';
|
|
70
|
+
|
|
71
|
+
@ApiPropertyOptional({
|
|
72
|
+
description:
|
|
73
|
+
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
74
|
+
'Example: `[{"key":"intention","op":"==","value":"clinic_info"}]`. ' +
|
|
75
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (value must be string pattern for SQL LIKE).',
|
|
76
|
+
type: String,
|
|
77
|
+
example: '[{"key":"intention","op":"==","value":"clinic_info"}]',
|
|
78
|
+
})
|
|
79
|
+
@IsOptional()
|
|
80
|
+
filters?: ParsedFilterDto[];
|
|
81
|
+
}
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
IsIn,
|
|
4
|
-
IsInt,
|
|
5
|
-
IsNotEmpty,
|
|
6
|
-
IsOptional,
|
|
7
|
-
IsString,
|
|
8
|
-
Max,
|
|
9
|
-
MaxLength,
|
|
10
|
-
Min,
|
|
11
|
-
} from 'class-validator';
|
|
12
|
-
|
|
13
|
-
/** Valid satisfaction survey types. */
|
|
14
|
-
export const SATISFACTION_TYPES = [
|
|
15
|
-
'satisfaction_booking',
|
|
16
|
-
'satisfaction_finished',
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
export type SatisfactionTypeDto = (typeof SATISFACTION_TYPES)[number];
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Payload to save a patient's satisfaction rating.
|
|
23
|
-
* Sent from the conversation-service to the followup-service
|
|
24
|
-
* when the AI detects a numeric satisfaction response.
|
|
25
|
-
*/
|
|
26
|
-
export class SaveSatisfactionRequestDto {
|
|
27
|
-
@ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
|
|
28
|
-
@IsString()
|
|
29
|
-
@IsNotEmpty()
|
|
30
|
-
tenant: string;
|
|
31
|
-
|
|
32
|
-
@ApiProperty({ description: 'Patient UUID' })
|
|
33
|
-
@IsString()
|
|
34
|
-
@IsNotEmpty()
|
|
35
|
-
patientId: string;
|
|
36
|
-
|
|
37
|
-
@ApiProperty({ description: 'Appointment UUID linked to the satisfaction survey' })
|
|
38
|
-
@IsString()
|
|
39
|
-
@IsNotEmpty()
|
|
40
|
-
appointmentId: string;
|
|
41
|
-
|
|
42
|
-
@ApiProperty({
|
|
43
|
-
description: 'Type of satisfaction survey',
|
|
44
|
-
enum: SATISFACTION_TYPES,
|
|
45
|
-
example: 'satisfaction_booking',
|
|
46
|
-
})
|
|
47
|
-
@IsIn(SATISFACTION_TYPES)
|
|
48
|
-
satisfactionType: SatisfactionTypeDto;
|
|
49
|
-
|
|
50
|
-
@ApiProperty({ description: 'Patient satisfaction rating (1-5)', example: 4 })
|
|
51
|
-
@IsInt()
|
|
52
|
-
@Min(1)
|
|
53
|
-
@Max(5)
|
|
54
|
-
rating: number;
|
|
55
|
-
|
|
56
|
-
@ApiPropertyOptional({ description: 'Optional text comment from the patient', example: 'Otimo atendimento!' })
|
|
57
|
-
@IsOptional()
|
|
58
|
-
@IsString()
|
|
59
|
-
@MaxLength(2000)
|
|
60
|
-
comment?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Response DTO for a saved satisfaction rating.
|
|
65
|
-
*/
|
|
66
|
-
export class SatisfactionResponseDto {
|
|
67
|
-
@ApiProperty({ description: 'Primary key (UUID)' })
|
|
68
|
-
@IsString()
|
|
69
|
-
@IsNotEmpty()
|
|
70
|
-
id: string;
|
|
71
|
-
|
|
72
|
-
@ApiProperty({ description: 'Patient UUID' })
|
|
73
|
-
@IsString()
|
|
74
|
-
@IsNotEmpty()
|
|
75
|
-
patientId: string;
|
|
76
|
-
|
|
77
|
-
@ApiProperty({ description: 'Appointment UUID' })
|
|
78
|
-
@IsString()
|
|
79
|
-
@IsNotEmpty()
|
|
80
|
-
appointmentId: string;
|
|
81
|
-
|
|
82
|
-
@ApiProperty({
|
|
83
|
-
description: 'Type of satisfaction survey',
|
|
84
|
-
enum: SATISFACTION_TYPES,
|
|
85
|
-
example: 'satisfaction_finished',
|
|
86
|
-
})
|
|
87
|
-
@IsIn(SATISFACTION_TYPES)
|
|
88
|
-
satisfactionType: SatisfactionTypeDto;
|
|
89
|
-
|
|
90
|
-
@ApiProperty({ description: 'Patient satisfaction rating (1-5)', example: 5 })
|
|
91
|
-
@IsInt()
|
|
92
|
-
@Min(1)
|
|
93
|
-
@Max(5)
|
|
94
|
-
rating: number;
|
|
95
|
-
|
|
96
|
-
@ApiPropertyOptional({ description: 'Optional text comment from the patient' })
|
|
97
|
-
@IsOptional()
|
|
98
|
-
@IsString()
|
|
99
|
-
comment?: string | null;
|
|
100
|
-
|
|
101
|
-
@ApiProperty({ description: 'Timestamp when the response was recorded (ISO 8601)' })
|
|
102
|
-
@IsString()
|
|
103
|
-
@IsNotEmpty()
|
|
104
|
-
createdAt: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Response DTO for average satisfaction stats.
|
|
109
|
-
*/
|
|
110
|
-
export class SatisfactionAverageDto {
|
|
111
|
-
@ApiProperty({ description: 'Average rating', example: 4.2 })
|
|
112
|
-
average: number;
|
|
113
|
-
|
|
114
|
-
@ApiProperty({ description: 'Total number of responses', example: 42 })
|
|
115
|
-
count: number;
|
|
116
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import {
|
|
3
|
+
IsIn,
|
|
4
|
+
IsInt,
|
|
5
|
+
IsNotEmpty,
|
|
6
|
+
IsOptional,
|
|
7
|
+
IsString,
|
|
8
|
+
Max,
|
|
9
|
+
MaxLength,
|
|
10
|
+
Min,
|
|
11
|
+
} from 'class-validator';
|
|
12
|
+
|
|
13
|
+
/** Valid satisfaction survey types. */
|
|
14
|
+
export const SATISFACTION_TYPES = [
|
|
15
|
+
'satisfaction_booking',
|
|
16
|
+
'satisfaction_finished',
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
export type SatisfactionTypeDto = (typeof SATISFACTION_TYPES)[number];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Payload to save a patient's satisfaction rating.
|
|
23
|
+
* Sent from the conversation-service to the followup-service
|
|
24
|
+
* when the AI detects a numeric satisfaction response.
|
|
25
|
+
*/
|
|
26
|
+
export class SaveSatisfactionRequestDto {
|
|
27
|
+
@ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
|
|
28
|
+
@IsString()
|
|
29
|
+
@IsNotEmpty()
|
|
30
|
+
tenant: string;
|
|
31
|
+
|
|
32
|
+
@ApiProperty({ description: 'Patient UUID' })
|
|
33
|
+
@IsString()
|
|
34
|
+
@IsNotEmpty()
|
|
35
|
+
patientId: string;
|
|
36
|
+
|
|
37
|
+
@ApiProperty({ description: 'Appointment UUID linked to the satisfaction survey' })
|
|
38
|
+
@IsString()
|
|
39
|
+
@IsNotEmpty()
|
|
40
|
+
appointmentId: string;
|
|
41
|
+
|
|
42
|
+
@ApiProperty({
|
|
43
|
+
description: 'Type of satisfaction survey',
|
|
44
|
+
enum: SATISFACTION_TYPES,
|
|
45
|
+
example: 'satisfaction_booking',
|
|
46
|
+
})
|
|
47
|
+
@IsIn(SATISFACTION_TYPES)
|
|
48
|
+
satisfactionType: SatisfactionTypeDto;
|
|
49
|
+
|
|
50
|
+
@ApiProperty({ description: 'Patient satisfaction rating (1-5)', example: 4 })
|
|
51
|
+
@IsInt()
|
|
52
|
+
@Min(1)
|
|
53
|
+
@Max(5)
|
|
54
|
+
rating: number;
|
|
55
|
+
|
|
56
|
+
@ApiPropertyOptional({ description: 'Optional text comment from the patient', example: 'Otimo atendimento!' })
|
|
57
|
+
@IsOptional()
|
|
58
|
+
@IsString()
|
|
59
|
+
@MaxLength(2000)
|
|
60
|
+
comment?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Response DTO for a saved satisfaction rating.
|
|
65
|
+
*/
|
|
66
|
+
export class SatisfactionResponseDto {
|
|
67
|
+
@ApiProperty({ description: 'Primary key (UUID)' })
|
|
68
|
+
@IsString()
|
|
69
|
+
@IsNotEmpty()
|
|
70
|
+
id: string;
|
|
71
|
+
|
|
72
|
+
@ApiProperty({ description: 'Patient UUID' })
|
|
73
|
+
@IsString()
|
|
74
|
+
@IsNotEmpty()
|
|
75
|
+
patientId: string;
|
|
76
|
+
|
|
77
|
+
@ApiProperty({ description: 'Appointment UUID' })
|
|
78
|
+
@IsString()
|
|
79
|
+
@IsNotEmpty()
|
|
80
|
+
appointmentId: string;
|
|
81
|
+
|
|
82
|
+
@ApiProperty({
|
|
83
|
+
description: 'Type of satisfaction survey',
|
|
84
|
+
enum: SATISFACTION_TYPES,
|
|
85
|
+
example: 'satisfaction_finished',
|
|
86
|
+
})
|
|
87
|
+
@IsIn(SATISFACTION_TYPES)
|
|
88
|
+
satisfactionType: SatisfactionTypeDto;
|
|
89
|
+
|
|
90
|
+
@ApiProperty({ description: 'Patient satisfaction rating (1-5)', example: 5 })
|
|
91
|
+
@IsInt()
|
|
92
|
+
@Min(1)
|
|
93
|
+
@Max(5)
|
|
94
|
+
rating: number;
|
|
95
|
+
|
|
96
|
+
@ApiPropertyOptional({ description: 'Optional text comment from the patient' })
|
|
97
|
+
@IsOptional()
|
|
98
|
+
@IsString()
|
|
99
|
+
comment?: string | null;
|
|
100
|
+
|
|
101
|
+
@ApiProperty({ description: 'Timestamp when the response was recorded (ISO 8601)' })
|
|
102
|
+
@IsString()
|
|
103
|
+
@IsNotEmpty()
|
|
104
|
+
createdAt: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Response DTO for average satisfaction stats.
|
|
109
|
+
*/
|
|
110
|
+
export class SatisfactionAverageDto {
|
|
111
|
+
@ApiProperty({ description: 'Average rating', example: 4.2 })
|
|
112
|
+
average: number;
|
|
113
|
+
|
|
114
|
+
@ApiProperty({ description: 'Total number of responses', example: 42 })
|
|
115
|
+
count: number;
|
|
116
|
+
}
|
package/src/filters/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './parsed-filter.dto';
|
|
1
|
+
export * from './parsed-filter.dto';
|