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.
Files changed (118) hide show
  1. package/README.md +33 -33
  2. package/dist/storage/delete-object-rpc.dto.d.ts +9 -0
  3. package/dist/storage/delete-object-rpc.dto.d.ts.map +1 -0
  4. package/dist/storage/delete-object-rpc.dto.js +48 -0
  5. package/dist/storage/index.d.ts +1 -0
  6. package/dist/storage/index.d.ts.map +1 -1
  7. package/dist/storage/index.js +1 -0
  8. package/dist/storage/storage-rmq-patterns.d.ts +2 -0
  9. package/dist/storage/storage-rmq-patterns.d.ts.map +1 -1
  10. package/dist/storage/storage-rmq-patterns.js +3 -1
  11. package/jest.config.ts +5 -5
  12. package/package.json +2 -1
  13. package/src/ai/ai-usage-response.dto.ts +47 -47
  14. package/src/ai/create-ai-usage.dto.ts +43 -43
  15. package/src/analytics/analytics-emitter.helper.ts +54 -54
  16. package/src/analytics/analytics-query.dto.ts +222 -222
  17. package/src/analytics/create-analytic-event.dto.ts +85 -85
  18. package/src/analytics/event-analytic.enum.ts +119 -119
  19. package/src/appointments/appointment-procedure.dto.ts +76 -76
  20. package/src/appointments/create-appointment.dto.ts +153 -153
  21. package/src/appointments/index.ts +10 -10
  22. package/src/appointments/list-appointments-query.dto.ts +157 -157
  23. package/src/appointments/update-appointment-procedure.dto.ts +10 -10
  24. package/src/appointments/update-appointment.dto.ts +4 -4
  25. package/src/auth/refresh-token.dto.ts +10 -10
  26. package/src/billing/billing-response.dto.ts +68 -68
  27. package/src/billing/create-billing.dto.ts +70 -70
  28. package/src/billing/index.ts +6 -6
  29. package/src/billing/list-billings-query.dto.ts +61 -61
  30. package/src/billing/update-billing.dto.ts +4 -4
  31. package/src/cashback/cashback-balance-response.dto.ts +33 -33
  32. package/src/cashback/cashback-config-response.dto.ts +43 -43
  33. package/src/cashback/cashback-enums.ts +33 -33
  34. package/src/cashback/cashback-kafka-payloads.ts +102 -102
  35. package/src/cashback/cashback-kafka-topics.ts +23 -23
  36. package/src/cashback/index.ts +7 -7
  37. package/src/cashback/referral-code-response.dto.ts +49 -49
  38. package/src/cashback/use-referral-code-response.dto.ts +15 -15
  39. package/src/configurations/clinic-configuration.dto.ts +39 -39
  40. package/src/configurations/opening-hours-slot.dto.ts +41 -41
  41. package/src/configurations/update-clinic-configuration.dto.ts +39 -39
  42. package/src/connections/whatsapp-official.dto.ts +113 -113
  43. package/src/conversations/conversation-contact-filters-query.validator.spec.ts +221 -221
  44. package/src/conversations/conversation-contact-filters-query.validator.ts +10 -10
  45. package/src/conversations/conversation-intention.dto.ts +24 -24
  46. package/src/conversations/conversation-response.dto.ts +69 -69
  47. package/src/conversations/conversation-session-response.dto.ts +65 -65
  48. package/src/conversations/conversation-type.dto.ts +15 -15
  49. package/src/conversations/create-conversation-session.dto.ts +28 -28
  50. package/src/conversations/create-conversation.dto.ts +69 -69
  51. package/src/conversations/followup-config-response.dto.ts +290 -290
  52. package/src/conversations/followup-log-response.dto.ts +58 -58
  53. package/src/conversations/followup-type.dto.ts +22 -22
  54. package/src/conversations/index.ts +17 -17
  55. package/src/conversations/list-conversation-contacts-filters.dto.ts +15 -15
  56. package/src/conversations/list-conversation-contacts-query.dto.ts +81 -81
  57. package/src/conversations/satisfaction-response.dto.ts +116 -116
  58. package/src/filters/index.ts +1 -1
  59. package/src/filters/parsed-filter.dto.ts +41 -41
  60. package/src/index.ts +23 -23
  61. package/src/patients/create-patient.dto.ts +122 -122
  62. package/src/patients/index.ts +10 -10
  63. package/src/patients/list-patients-filters.dto.ts +15 -15
  64. package/src/patients/list-patients-query.dto.ts +61 -61
  65. package/src/patients/patient-document-response.dto.ts +33 -33
  66. package/src/patients/patient-history-entry.dto.ts +22 -22
  67. package/src/patients/patient-status.dto.ts +9 -9
  68. package/src/patients/update-patient-document.dto.ts +10 -10
  69. package/src/patients/update-patient.dto.ts +15 -15
  70. package/src/payment-gateway/create-gateway-payment.dto.ts +123 -123
  71. package/src/payment-gateway/gateway-payment-response.dto.ts +65 -65
  72. package/src/payment-gateway/index.ts +12 -12
  73. package/src/payment-gateway/list-gateway-payments-query.dto.ts +63 -63
  74. package/src/payment-gateway/payment-gateway-kafka-topics.ts +25 -25
  75. package/src/payment-gateway/payment-gateway.enums.ts +34 -34
  76. package/src/payment-gateway/update-gateway-payment.dto.ts +7 -7
  77. package/src/payment-gateway/webhook-payload.dto.ts +32 -32
  78. package/src/payments/create-payment.dto.ts +73 -73
  79. package/src/payments/index.ts +6 -6
  80. package/src/payments/list-payments-query.dto.ts +44 -44
  81. package/src/payments/payment-response.dto.ts +67 -67
  82. package/src/payments/update-payment.dto.ts +4 -4
  83. package/src/procedures/create-procedure.dto.ts +104 -104
  84. package/src/procedures/index.ts +6 -6
  85. package/src/procedures/list-procedures-query.dto.ts +59 -59
  86. package/src/procedures/update-procedure.dto.ts +4 -4
  87. package/src/storage/delete-object-rpc.dto.ts +28 -0
  88. package/src/storage/index.ts +1 -0
  89. package/src/storage/storage-rmq-patterns.ts +3 -0
  90. package/src/tenants/index.ts +10 -10
  91. package/src/tenants/whatsapp-provider-kind.dto.ts +12 -12
  92. package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts +0 -7
  93. package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts.map +0 -1
  94. package/dist/analytics/should-skip-analytics-tenant-lookup.js +0 -13
  95. package/dist/appointments/opening-hours-slot.dto.d.ts +0 -6
  96. package/dist/appointments/opening-hours-slot.dto.d.ts.map +0 -1
  97. package/dist/appointments/opening-hours-slot.dto.js +0 -2
  98. package/dist/patients/patient-procedure.dto.d.ts +0 -9
  99. package/dist/patients/patient-procedure.dto.d.ts.map +0 -1
  100. package/dist/patients/patient-procedure.dto.js +0 -79
  101. package/dist/patients/update-patient-procedure.dto.d.ts +0 -6
  102. package/dist/patients/update-patient-procedure.dto.d.ts.map +0 -1
  103. package/dist/patients/update-patient-procedure.dto.js +0 -8
  104. package/dist/payments/payment.dto.d.ts +0 -15
  105. package/dist/payments/payment.dto.d.ts.map +0 -1
  106. package/dist/payments/payment.dto.js +0 -2
  107. package/dist/tenants/create-tenant.dto.d.ts +0 -10
  108. package/dist/tenants/create-tenant.dto.d.ts.map +0 -1
  109. package/dist/tenants/create-tenant.dto.js +0 -73
  110. package/dist/tenants/tenant-slug.util.spec.d.ts +0 -2
  111. package/dist/tenants/tenant-slug.util.spec.d.ts.map +0 -1
  112. package/dist/tenants/tenant-slug.util.spec.js +0 -102
  113. package/dist/tenants/update-tenant-payload.dto.d.ts +0 -6
  114. package/dist/tenants/update-tenant-payload.dto.d.ts.map +0 -1
  115. package/dist/tenants/update-tenant-payload.dto.js +0 -25
  116. package/dist/tenants/update-tenant.dto.d.ts +0 -10
  117. package/dist/tenants/update-tenant.dto.d.ts.map +0 -1
  118. package/dist/tenants/update-tenant.dto.js +0 -78
@@ -1,10 +1,10 @@
1
- /**
2
- * @deprecated The filter validation logic has been moved to the API gateway.
3
- * This file is kept only for backward compatibility with existing imports.
4
- * The gateway now parses and validates the filters string before forwarding
5
- * the pre-validated ParsedFilterDto[] to the microservice.
6
- */
7
- export {
8
- CONVERSATION_CONTACT_LIST_FILTER_KEYS,
9
- type ConversationContactListFilterKeyDto,
10
- } from './list-conversation-contacts-query.dto';
1
+ /**
2
+ * @deprecated The filter validation logic has been moved to the API gateway.
3
+ * This file is kept only for backward compatibility with existing imports.
4
+ * The gateway now parses and validates the filters string before forwarding
5
+ * the pre-validated ParsedFilterDto[] to the microservice.
6
+ */
7
+ export {
8
+ CONVERSATION_CONTACT_LIST_FILTER_KEYS,
9
+ type ConversationContactListFilterKeyDto,
10
+ } from './list-conversation-contacts-query.dto';
@@ -1,24 +1,24 @@
1
- /**
2
- * All possible user intention types detected by the AI during a conversation.
3
- * Used to drive follow-up logic when the user becomes inactive.
4
- */
5
- export const CONVERSATION_INTENTIONS = [
6
- 'greeting',
7
- 'ask_services',
8
- 'ask_prices',
9
- 'ask_availability',
10
- 'select_service',
11
- 'provide_datetime',
12
- 'confirm_appointment',
13
- 'reject_appointment',
14
- 'provide_data',
15
- 'reschedule',
16
- 'cancel_appointment',
17
- 'check_appointment',
18
- 'clinic_info',
19
- 'human_handoff',
20
- 'out_of_scope',
21
- 'unclear',
22
- ] as const;
23
-
24
- export type ConversationIntentionDto = (typeof CONVERSATION_INTENTIONS)[number];
1
+ /**
2
+ * All possible user intention types detected by the AI during a conversation.
3
+ * Used to drive follow-up logic when the user becomes inactive.
4
+ */
5
+ export const CONVERSATION_INTENTIONS = [
6
+ 'greeting',
7
+ 'ask_services',
8
+ 'ask_prices',
9
+ 'ask_availability',
10
+ 'select_service',
11
+ 'provide_datetime',
12
+ 'confirm_appointment',
13
+ 'reject_appointment',
14
+ 'provide_data',
15
+ 'reschedule',
16
+ 'cancel_appointment',
17
+ 'check_appointment',
18
+ 'clinic_info',
19
+ 'human_handoff',
20
+ 'out_of_scope',
21
+ 'unclear',
22
+ ] as const;
23
+
24
+ export type ConversationIntentionDto = (typeof CONVERSATION_INTENTIONS)[number];
@@ -1,69 +1,69 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import { IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
3
- import { ConversationMessageTypeDto } from './conversation-type.dto';
4
-
5
- /**
6
- * Represents a persisted conversation message returned by the API.
7
- */
8
- export class ConversationResponseDto {
9
- @ApiProperty({ description: 'Conversation message UUID', example: 'a1b2c3d4-...' })
10
- @IsString()
11
- @IsNotEmpty()
12
- id: string;
13
-
14
- @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
15
- @IsString()
16
- @IsNotEmpty()
17
- tenant: string;
18
-
19
- @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
20
- @IsOptional()
21
- unitId?: number;
22
-
23
- @ApiProperty({
24
- description: 'Patient UUID',
25
- example: '550e8400-e29b-41d4-a716-446655440000',
26
- })
27
- @IsString()
28
- @IsNotEmpty()
29
- @IsUUID()
30
- patientId: string;
31
-
32
- @ApiProperty({
33
- description: 'Session UUID grouping messages within the 24-hour window',
34
- example: 'a1b2c3d4-...',
35
- })
36
- @IsString()
37
- @IsNotEmpty()
38
- sessionUuid: string;
39
-
40
- @ApiProperty({
41
- description: 'Conversation message type: "ia", "human" or "patient"',
42
- example: 'patient',
43
- })
44
- type: ConversationMessageTypeDto;
45
-
46
- @ApiProperty({
47
- description: 'Message content',
48
- example: 'Sure! Let me look up available slots for you.',
49
- })
50
- @IsString()
51
- @IsNotEmpty()
52
- message: string;
53
-
54
- @ApiPropertyOptional({
55
- description: 'AI usage record ID (only present when type is "ia")',
56
- example: 'a1b2c3d4-...',
57
- })
58
- @IsOptional()
59
- @IsString()
60
- aiUsageId?: string;
61
-
62
- @ApiProperty({
63
- description: 'Creation timestamp (ISO 8601)',
64
- example: '2024-01-01T00:00:00.000Z',
65
- })
66
- @IsString()
67
- @IsNotEmpty()
68
- createdAt: string;
69
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import { IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
3
+ import { ConversationMessageTypeDto } from './conversation-type.dto';
4
+
5
+ /**
6
+ * Represents a persisted conversation message returned by the API.
7
+ */
8
+ export class ConversationResponseDto {
9
+ @ApiProperty({ description: 'Conversation message UUID', example: 'a1b2c3d4-...' })
10
+ @IsString()
11
+ @IsNotEmpty()
12
+ id: string;
13
+
14
+ @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
15
+ @IsString()
16
+ @IsNotEmpty()
17
+ tenant: string;
18
+
19
+ @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
20
+ @IsOptional()
21
+ unitId?: number;
22
+
23
+ @ApiProperty({
24
+ description: 'Patient UUID',
25
+ example: '550e8400-e29b-41d4-a716-446655440000',
26
+ })
27
+ @IsString()
28
+ @IsNotEmpty()
29
+ @IsUUID()
30
+ patientId: string;
31
+
32
+ @ApiProperty({
33
+ description: 'Session UUID grouping messages within the 24-hour window',
34
+ example: 'a1b2c3d4-...',
35
+ })
36
+ @IsString()
37
+ @IsNotEmpty()
38
+ sessionUuid: string;
39
+
40
+ @ApiProperty({
41
+ description: 'Conversation message type: "ia", "human" or "patient"',
42
+ example: 'patient',
43
+ })
44
+ type: ConversationMessageTypeDto;
45
+
46
+ @ApiProperty({
47
+ description: 'Message content',
48
+ example: 'Sure! Let me look up available slots for you.',
49
+ })
50
+ @IsString()
51
+ @IsNotEmpty()
52
+ message: string;
53
+
54
+ @ApiPropertyOptional({
55
+ description: 'AI usage record ID (only present when type is "ia")',
56
+ example: 'a1b2c3d4-...',
57
+ })
58
+ @IsOptional()
59
+ @IsString()
60
+ aiUsageId?: string;
61
+
62
+ @ApiProperty({
63
+ description: 'Creation timestamp (ISO 8601)',
64
+ example: '2024-01-01T00:00:00.000Z',
65
+ })
66
+ @IsString()
67
+ @IsNotEmpty()
68
+ createdAt: string;
69
+ }
@@ -1,65 +1,65 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import { IsEnum, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
3
- import { CONVERSATION_INTENTIONS, ConversationIntentionDto } from './conversation-intention.dto';
4
-
5
- /**
6
- * Represents a conversation session record returned by the API.
7
- * A session is valid for 24 hours from its start time.
8
- */
9
- export class ConversationSessionResponseDto {
10
- @ApiProperty({ description: 'Session primary key (UUID)', example: 'a1b2c3d4-...' })
11
- @IsString()
12
- @IsNotEmpty()
13
- id: string;
14
-
15
- @ApiProperty({
16
- description: 'Session UUID used to group all messages within the 24-hour window',
17
- example: 'a1b2c3d4-...',
18
- })
19
- @IsString()
20
- @IsNotEmpty()
21
- sessionUuid: string;
22
-
23
- @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
24
- @IsString()
25
- @IsNotEmpty()
26
- tenant: string;
27
-
28
- @ApiProperty({
29
- description: 'Patient UUID',
30
- example: '550e8400-e29b-41d4-a716-446655440000',
31
- })
32
- @IsString()
33
- @IsNotEmpty()
34
- @IsUUID()
35
- patientId: string;
36
-
37
- @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
38
- @IsOptional()
39
- unitId?: number;
40
-
41
- @ApiPropertyOptional({
42
- description: 'User intention detected by the AI for this session',
43
- enum: CONVERSATION_INTENTIONS,
44
- example: 'ask_services',
45
- })
46
- @IsOptional()
47
- @IsEnum(CONVERSATION_INTENTIONS)
48
- intention?: ConversationIntentionDto;
49
-
50
- @ApiProperty({
51
- description: 'Session start timestamp (ISO 8601)',
52
- example: '2024-01-01T00:00:00.000Z',
53
- })
54
- @IsString()
55
- @IsNotEmpty()
56
- startedAt: string;
57
-
58
- @ApiProperty({
59
- description: 'Session expiration timestamp (ISO 8601, 24 h after start)',
60
- example: '2024-01-02T00:00:00.000Z',
61
- })
62
- @IsString()
63
- @IsNotEmpty()
64
- expiresAt: string;
65
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import { IsEnum, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
3
+ import { CONVERSATION_INTENTIONS, ConversationIntentionDto } from './conversation-intention.dto';
4
+
5
+ /**
6
+ * Represents a conversation session record returned by the API.
7
+ * A session is valid for 24 hours from its start time.
8
+ */
9
+ export class ConversationSessionResponseDto {
10
+ @ApiProperty({ description: 'Session primary key (UUID)', example: 'a1b2c3d4-...' })
11
+ @IsString()
12
+ @IsNotEmpty()
13
+ id: string;
14
+
15
+ @ApiProperty({
16
+ description: 'Session UUID used to group all messages within the 24-hour window',
17
+ example: 'a1b2c3d4-...',
18
+ })
19
+ @IsString()
20
+ @IsNotEmpty()
21
+ sessionUuid: string;
22
+
23
+ @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
24
+ @IsString()
25
+ @IsNotEmpty()
26
+ tenant: string;
27
+
28
+ @ApiProperty({
29
+ description: 'Patient UUID',
30
+ example: '550e8400-e29b-41d4-a716-446655440000',
31
+ })
32
+ @IsString()
33
+ @IsNotEmpty()
34
+ @IsUUID()
35
+ patientId: string;
36
+
37
+ @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
38
+ @IsOptional()
39
+ unitId?: number;
40
+
41
+ @ApiPropertyOptional({
42
+ description: 'User intention detected by the AI for this session',
43
+ enum: CONVERSATION_INTENTIONS,
44
+ example: 'ask_services',
45
+ })
46
+ @IsOptional()
47
+ @IsEnum(CONVERSATION_INTENTIONS)
48
+ intention?: ConversationIntentionDto;
49
+
50
+ @ApiProperty({
51
+ description: 'Session start timestamp (ISO 8601)',
52
+ example: '2024-01-01T00:00:00.000Z',
53
+ })
54
+ @IsString()
55
+ @IsNotEmpty()
56
+ startedAt: string;
57
+
58
+ @ApiProperty({
59
+ description: 'Session expiration timestamp (ISO 8601, 24 h after start)',
60
+ example: '2024-01-02T00:00:00.000Z',
61
+ })
62
+ @IsString()
63
+ @IsNotEmpty()
64
+ expiresAt: string;
65
+ }
@@ -1,15 +1,15 @@
1
- // Allowed conversation session types.
2
- // "ia" → patient interacting with the AI.
3
- // "human" → human staff member responding to the patient.
4
- // "waiting" → waiting queue for human handoff.
5
- export const CONVERSATION_SESSION_TYPES = ['ia', 'human', 'waiting'] as const;
6
-
7
- // Backwards-compatible alias for session types.
8
- export const CONVERSATION_TYPES = CONVERSATION_SESSION_TYPES;
9
-
10
- export type ConversationTypeDto = (typeof CONVERSATION_SESSION_TYPES)[number];
11
-
12
- // Allowed conversation message types for the `conversations` table.
13
- // "patient" → message authored by the patient/user (WhatsApp sender).
14
- export const CONVERSATION_MESSAGE_TYPES = ['ia', 'human', 'patient'] as const;
15
- export type ConversationMessageTypeDto = (typeof CONVERSATION_MESSAGE_TYPES)[number];
1
+ // Allowed conversation session types.
2
+ // "ia" → patient interacting with the AI.
3
+ // "human" → human staff member responding to the patient.
4
+ // "waiting" → waiting queue for human handoff.
5
+ export const CONVERSATION_SESSION_TYPES = ['ia', 'human', 'waiting'] as const;
6
+
7
+ // Backwards-compatible alias for session types.
8
+ export const CONVERSATION_TYPES = CONVERSATION_SESSION_TYPES;
9
+
10
+ export type ConversationTypeDto = (typeof CONVERSATION_SESSION_TYPES)[number];
11
+
12
+ // Allowed conversation message types for the `conversations` table.
13
+ // "patient" → message authored by the patient/user (WhatsApp sender).
14
+ export const CONVERSATION_MESSAGE_TYPES = ['ia', 'human', 'patient'] as const;
15
+ export type ConversationMessageTypeDto = (typeof CONVERSATION_MESSAGE_TYPES)[number];
@@ -1,28 +1,28 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import { IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Min } from 'class-validator';
3
-
4
- /**
5
- * Payload used to obtain (or create) an active 24-hour conversation session
6
- * for a given patient + tenant combination.
7
- */
8
- export class CreateConversationSessionDto {
9
- @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
10
- @IsString()
11
- @IsNotEmpty()
12
- tenant: string;
13
-
14
- @ApiProperty({
15
- description: 'Patient UUID',
16
- example: '550e8400-e29b-41d4-a716-446655440000',
17
- })
18
- @IsString()
19
- @IsNotEmpty()
20
- @IsUUID()
21
- patientId: string;
22
-
23
- @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
24
- @IsOptional()
25
- @IsInt()
26
- @Min(1)
27
- unitId?: number;
28
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import { IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Min } from 'class-validator';
3
+
4
+ /**
5
+ * Payload used to obtain (or create) an active 24-hour conversation session
6
+ * for a given patient + tenant combination.
7
+ */
8
+ export class CreateConversationSessionDto {
9
+ @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
10
+ @IsString()
11
+ @IsNotEmpty()
12
+ tenant: string;
13
+
14
+ @ApiProperty({
15
+ description: 'Patient UUID',
16
+ example: '550e8400-e29b-41d4-a716-446655440000',
17
+ })
18
+ @IsString()
19
+ @IsNotEmpty()
20
+ @IsUUID()
21
+ patientId: string;
22
+
23
+ @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
24
+ @IsOptional()
25
+ @IsInt()
26
+ @Min(1)
27
+ unitId?: number;
28
+ }
@@ -1,69 +1,69 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import {
3
- IsEnum,
4
- IsInt,
5
- IsNotEmpty,
6
- IsOptional,
7
- IsString,
8
- IsUUID,
9
- Min,
10
- } from 'class-validator';
11
- import { CONVERSATION_MESSAGE_TYPES, ConversationMessageTypeDto } from './conversation-type.dto';
12
-
13
- /**
14
- * Payload used to persist a single conversation message.
15
- * AiUsageId must be provided whenever type is "ia" so token costs can be tracked.
16
- */
17
- export class CreateConversationDto {
18
- @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
19
- @IsString()
20
- @IsNotEmpty()
21
- tenant: string;
22
-
23
- @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
24
- @IsOptional()
25
- @IsInt()
26
- @Min(1)
27
- unitId?: number;
28
-
29
- @ApiProperty({
30
- description: 'Patient UUID',
31
- example: '5511999999999',
32
- })
33
- @IsString()
34
- @IsNotEmpty()
35
- @IsUUID()
36
- patientId: string;
37
-
38
- @ApiProperty({
39
- description: 'Session UUID that groups messages within the 24-hour window',
40
- example: 'a1b2c3d4-...',
41
- })
42
- @IsUUID()
43
- sessionUuid: string;
44
-
45
- @ApiProperty({
46
- description:
47
- 'Conversation message type: "ia" when the AI responds, "human" when staff responds, "patient" when the patient/user sends the message',
48
- enum: CONVERSATION_MESSAGE_TYPES,
49
- example: 'patient',
50
- })
51
- @IsEnum(CONVERSATION_MESSAGE_TYPES)
52
- type: ConversationMessageTypeDto;
53
-
54
- @ApiProperty({
55
- description: 'Message content',
56
- example: 'Hello, I need to schedule an appointment.',
57
- })
58
- @IsString()
59
- @IsNotEmpty()
60
- message: string;
61
-
62
- @ApiPropertyOptional({
63
- description: 'AI usage record ID — required when type is "ia"',
64
- example: 'a1b2c3d4-...',
65
- })
66
- @IsOptional()
67
- @IsString()
68
- aiUsageId?: string;
69
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import {
3
+ IsEnum,
4
+ IsInt,
5
+ IsNotEmpty,
6
+ IsOptional,
7
+ IsString,
8
+ IsUUID,
9
+ Min,
10
+ } from 'class-validator';
11
+ import { CONVERSATION_MESSAGE_TYPES, ConversationMessageTypeDto } from './conversation-type.dto';
12
+
13
+ /**
14
+ * Payload used to persist a single conversation message.
15
+ * AiUsageId must be provided whenever type is "ia" so token costs can be tracked.
16
+ */
17
+ export class CreateConversationDto {
18
+ @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
19
+ @IsString()
20
+ @IsNotEmpty()
21
+ tenant: string;
22
+
23
+ @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
24
+ @IsOptional()
25
+ @IsInt()
26
+ @Min(1)
27
+ unitId?: number;
28
+
29
+ @ApiProperty({
30
+ description: 'Patient UUID',
31
+ example: '5511999999999',
32
+ })
33
+ @IsString()
34
+ @IsNotEmpty()
35
+ @IsUUID()
36
+ patientId: string;
37
+
38
+ @ApiProperty({
39
+ description: 'Session UUID that groups messages within the 24-hour window',
40
+ example: 'a1b2c3d4-...',
41
+ })
42
+ @IsUUID()
43
+ sessionUuid: string;
44
+
45
+ @ApiProperty({
46
+ description:
47
+ 'Conversation message type: "ia" when the AI responds, "human" when staff responds, "patient" when the patient/user sends the message',
48
+ enum: CONVERSATION_MESSAGE_TYPES,
49
+ example: 'patient',
50
+ })
51
+ @IsEnum(CONVERSATION_MESSAGE_TYPES)
52
+ type: ConversationMessageTypeDto;
53
+
54
+ @ApiProperty({
55
+ description: 'Message content',
56
+ example: 'Hello, I need to schedule an appointment.',
57
+ })
58
+ @IsString()
59
+ @IsNotEmpty()
60
+ message: string;
61
+
62
+ @ApiPropertyOptional({
63
+ description: 'AI usage record ID — required when type is "ia"',
64
+ example: 'a1b2c3d4-...',
65
+ })
66
+ @IsOptional()
67
+ @IsString()
68
+ aiUsageId?: string;
69
+ }