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,153 +1,153 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { Type } from 'class-transformer';
|
|
3
|
-
import {
|
|
4
|
-
IsArray,
|
|
5
|
-
IsBoolean,
|
|
6
|
-
IsDateString,
|
|
7
|
-
IsEnum,
|
|
8
|
-
IsNotEmpty,
|
|
9
|
-
IsOptional,
|
|
10
|
-
IsString,
|
|
11
|
-
IsUUID,
|
|
12
|
-
ValidateNested,
|
|
13
|
-
} from 'class-validator';
|
|
14
|
-
import { AppointmentProcedureDto } from './appointment-procedure.dto';
|
|
15
|
-
import {
|
|
16
|
-
APPOINTMENT_STATUSES,
|
|
17
|
-
APPOINTMENT_TYPES,
|
|
18
|
-
AppointmentStatusDto,
|
|
19
|
-
AppointmentTypeDto,
|
|
20
|
-
} from './appointment-status.dto';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export class CreateAppointmentDto {
|
|
25
|
-
@ApiProperty({
|
|
26
|
-
description: 'ID do paciente (UUID)',
|
|
27
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
28
|
-
})
|
|
29
|
-
@IsUUID('4')
|
|
30
|
-
@IsNotEmpty()
|
|
31
|
-
patientId: string;
|
|
32
|
-
|
|
33
|
-
@ApiProperty({
|
|
34
|
-
description: 'Data e hora do agendamento (ISO 8601)',
|
|
35
|
-
example: '2026-03-15T14:00:00.000Z',
|
|
36
|
-
})
|
|
37
|
-
@IsDateString()
|
|
38
|
-
date: string;
|
|
39
|
-
|
|
40
|
-
@ApiProperty({
|
|
41
|
-
description: 'ID do profissional de saúde atrelado ao agendamento (UUID)',
|
|
42
|
-
example: '550e8400-e29b-41d4-a716-446655440001',
|
|
43
|
-
})
|
|
44
|
-
@IsUUID('4')
|
|
45
|
-
@IsNotEmpty()
|
|
46
|
-
userId: string;
|
|
47
|
-
|
|
48
|
-
@ApiPropertyOptional({
|
|
49
|
-
description: 'Indica se o check-in foi realizado',
|
|
50
|
-
example: false,
|
|
51
|
-
default: false,
|
|
52
|
-
})
|
|
53
|
-
@IsOptional()
|
|
54
|
-
@IsBoolean()
|
|
55
|
-
checkinCompleted?: boolean;
|
|
56
|
-
|
|
57
|
-
@ApiPropertyOptional({
|
|
58
|
-
description: 'Indica se o check-out foi realizado',
|
|
59
|
-
example: false,
|
|
60
|
-
default: false,
|
|
61
|
-
})
|
|
62
|
-
@IsOptional()
|
|
63
|
-
@IsBoolean()
|
|
64
|
-
checkoutCompleted?: boolean;
|
|
65
|
-
|
|
66
|
-
@ApiPropertyOptional({
|
|
67
|
-
description: 'Horário de saída do atendimento (ISO 8601)',
|
|
68
|
-
example: '2026-03-15T14:45:00.000Z',
|
|
69
|
-
})
|
|
70
|
-
@IsOptional()
|
|
71
|
-
@IsDateString()
|
|
72
|
-
exitTime?: string;
|
|
73
|
-
|
|
74
|
-
@ApiPropertyOptional({
|
|
75
|
-
description: 'Observação do agendamento',
|
|
76
|
-
example: 'Paciente solicitou prioridade no retorno.',
|
|
77
|
-
})
|
|
78
|
-
@IsOptional()
|
|
79
|
-
@IsString()
|
|
80
|
-
observation?: string;
|
|
81
|
-
|
|
82
|
-
@ApiPropertyOptional({
|
|
83
|
-
description: 'Motivo do cancelamento',
|
|
84
|
-
example: 'Paciente não compareceu.',
|
|
85
|
-
})
|
|
86
|
-
@IsOptional()
|
|
87
|
-
@IsString()
|
|
88
|
-
cancellationReason?: string;
|
|
89
|
-
|
|
90
|
-
@ApiPropertyOptional({
|
|
91
|
-
description: 'Status do agendamento',
|
|
92
|
-
enum: APPOINTMENT_STATUSES,
|
|
93
|
-
default: 'pending',
|
|
94
|
-
})
|
|
95
|
-
@IsOptional()
|
|
96
|
-
@IsEnum(APPOINTMENT_STATUSES)
|
|
97
|
-
status?: AppointmentStatusDto;
|
|
98
|
-
|
|
99
|
-
@ApiPropertyOptional({
|
|
100
|
-
description: 'Tipo do agendamento (regular ou retorno)',
|
|
101
|
-
enum: APPOINTMENT_TYPES,
|
|
102
|
-
default: 'regular',
|
|
103
|
-
})
|
|
104
|
-
@IsOptional()
|
|
105
|
-
@IsEnum(APPOINTMENT_TYPES)
|
|
106
|
-
appointmentType?: AppointmentTypeDto;
|
|
107
|
-
|
|
108
|
-
@ApiPropertyOptional({
|
|
109
|
-
description: 'UUID do agendamento original que foi reagendado (se for reagendamento)',
|
|
110
|
-
example: '550e8400-e29b-41d4-a716-446655440003',
|
|
111
|
-
})
|
|
112
|
-
@IsOptional()
|
|
113
|
-
@IsUUID('4')
|
|
114
|
-
rescheduledFromId?: string;
|
|
115
|
-
|
|
116
|
-
@ApiPropertyOptional({
|
|
117
|
-
description: 'UUID do agendamento original ao qual este retorno está vinculado',
|
|
118
|
-
example: '550e8400-e29b-41d4-a716-446655440004',
|
|
119
|
-
})
|
|
120
|
-
@IsOptional()
|
|
121
|
-
@IsUUID('4')
|
|
122
|
-
returnFromAppointmentId?: string;
|
|
123
|
-
|
|
124
|
-
@ApiPropertyOptional({
|
|
125
|
-
description:
|
|
126
|
-
'Procedimentos a gravar junto com o agendamento (analytics `appointment.created` inclui a lista)',
|
|
127
|
-
type: [AppointmentProcedureDto],
|
|
128
|
-
})
|
|
129
|
-
@IsOptional()
|
|
130
|
-
@IsArray()
|
|
131
|
-
@ValidateNested({ each: true })
|
|
132
|
-
@Type(() => AppointmentProcedureDto)
|
|
133
|
-
initialProcedures?: AppointmentProcedureDto[];
|
|
134
|
-
|
|
135
|
-
@ApiPropertyOptional({
|
|
136
|
-
description: 'Sinaliza que o fluxo de criação já pediu disparo de termo jurídico para o paciente',
|
|
137
|
-
default: false,
|
|
138
|
-
})
|
|
139
|
-
@IsOptional()
|
|
140
|
-
@IsBoolean()
|
|
141
|
-
legalTermRequested?: boolean;
|
|
142
|
-
|
|
143
|
-
@ApiPropertyOptional({
|
|
144
|
-
description:
|
|
145
|
-
'IDs de procedimentos (UUID) usados como contexto do termo jurídico solicitado na criação do agendamento',
|
|
146
|
-
type: [String],
|
|
147
|
-
format: 'uuid',
|
|
148
|
-
})
|
|
149
|
-
@IsOptional()
|
|
150
|
-
@IsArray()
|
|
151
|
-
@IsUUID('4', { each: true })
|
|
152
|
-
legalTermProcedureIds?: string[];
|
|
153
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
IsArray,
|
|
5
|
+
IsBoolean,
|
|
6
|
+
IsDateString,
|
|
7
|
+
IsEnum,
|
|
8
|
+
IsNotEmpty,
|
|
9
|
+
IsOptional,
|
|
10
|
+
IsString,
|
|
11
|
+
IsUUID,
|
|
12
|
+
ValidateNested,
|
|
13
|
+
} from 'class-validator';
|
|
14
|
+
import { AppointmentProcedureDto } from './appointment-procedure.dto';
|
|
15
|
+
import {
|
|
16
|
+
APPOINTMENT_STATUSES,
|
|
17
|
+
APPOINTMENT_TYPES,
|
|
18
|
+
AppointmentStatusDto,
|
|
19
|
+
AppointmentTypeDto,
|
|
20
|
+
} from './appointment-status.dto';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export class CreateAppointmentDto {
|
|
25
|
+
@ApiProperty({
|
|
26
|
+
description: 'ID do paciente (UUID)',
|
|
27
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
28
|
+
})
|
|
29
|
+
@IsUUID('4')
|
|
30
|
+
@IsNotEmpty()
|
|
31
|
+
patientId: string;
|
|
32
|
+
|
|
33
|
+
@ApiProperty({
|
|
34
|
+
description: 'Data e hora do agendamento (ISO 8601)',
|
|
35
|
+
example: '2026-03-15T14:00:00.000Z',
|
|
36
|
+
})
|
|
37
|
+
@IsDateString()
|
|
38
|
+
date: string;
|
|
39
|
+
|
|
40
|
+
@ApiProperty({
|
|
41
|
+
description: 'ID do profissional de saúde atrelado ao agendamento (UUID)',
|
|
42
|
+
example: '550e8400-e29b-41d4-a716-446655440001',
|
|
43
|
+
})
|
|
44
|
+
@IsUUID('4')
|
|
45
|
+
@IsNotEmpty()
|
|
46
|
+
userId: string;
|
|
47
|
+
|
|
48
|
+
@ApiPropertyOptional({
|
|
49
|
+
description: 'Indica se o check-in foi realizado',
|
|
50
|
+
example: false,
|
|
51
|
+
default: false,
|
|
52
|
+
})
|
|
53
|
+
@IsOptional()
|
|
54
|
+
@IsBoolean()
|
|
55
|
+
checkinCompleted?: boolean;
|
|
56
|
+
|
|
57
|
+
@ApiPropertyOptional({
|
|
58
|
+
description: 'Indica se o check-out foi realizado',
|
|
59
|
+
example: false,
|
|
60
|
+
default: false,
|
|
61
|
+
})
|
|
62
|
+
@IsOptional()
|
|
63
|
+
@IsBoolean()
|
|
64
|
+
checkoutCompleted?: boolean;
|
|
65
|
+
|
|
66
|
+
@ApiPropertyOptional({
|
|
67
|
+
description: 'Horário de saída do atendimento (ISO 8601)',
|
|
68
|
+
example: '2026-03-15T14:45:00.000Z',
|
|
69
|
+
})
|
|
70
|
+
@IsOptional()
|
|
71
|
+
@IsDateString()
|
|
72
|
+
exitTime?: string;
|
|
73
|
+
|
|
74
|
+
@ApiPropertyOptional({
|
|
75
|
+
description: 'Observação do agendamento',
|
|
76
|
+
example: 'Paciente solicitou prioridade no retorno.',
|
|
77
|
+
})
|
|
78
|
+
@IsOptional()
|
|
79
|
+
@IsString()
|
|
80
|
+
observation?: string;
|
|
81
|
+
|
|
82
|
+
@ApiPropertyOptional({
|
|
83
|
+
description: 'Motivo do cancelamento',
|
|
84
|
+
example: 'Paciente não compareceu.',
|
|
85
|
+
})
|
|
86
|
+
@IsOptional()
|
|
87
|
+
@IsString()
|
|
88
|
+
cancellationReason?: string;
|
|
89
|
+
|
|
90
|
+
@ApiPropertyOptional({
|
|
91
|
+
description: 'Status do agendamento',
|
|
92
|
+
enum: APPOINTMENT_STATUSES,
|
|
93
|
+
default: 'pending',
|
|
94
|
+
})
|
|
95
|
+
@IsOptional()
|
|
96
|
+
@IsEnum(APPOINTMENT_STATUSES)
|
|
97
|
+
status?: AppointmentStatusDto;
|
|
98
|
+
|
|
99
|
+
@ApiPropertyOptional({
|
|
100
|
+
description: 'Tipo do agendamento (regular ou retorno)',
|
|
101
|
+
enum: APPOINTMENT_TYPES,
|
|
102
|
+
default: 'regular',
|
|
103
|
+
})
|
|
104
|
+
@IsOptional()
|
|
105
|
+
@IsEnum(APPOINTMENT_TYPES)
|
|
106
|
+
appointmentType?: AppointmentTypeDto;
|
|
107
|
+
|
|
108
|
+
@ApiPropertyOptional({
|
|
109
|
+
description: 'UUID do agendamento original que foi reagendado (se for reagendamento)',
|
|
110
|
+
example: '550e8400-e29b-41d4-a716-446655440003',
|
|
111
|
+
})
|
|
112
|
+
@IsOptional()
|
|
113
|
+
@IsUUID('4')
|
|
114
|
+
rescheduledFromId?: string;
|
|
115
|
+
|
|
116
|
+
@ApiPropertyOptional({
|
|
117
|
+
description: 'UUID do agendamento original ao qual este retorno está vinculado',
|
|
118
|
+
example: '550e8400-e29b-41d4-a716-446655440004',
|
|
119
|
+
})
|
|
120
|
+
@IsOptional()
|
|
121
|
+
@IsUUID('4')
|
|
122
|
+
returnFromAppointmentId?: string;
|
|
123
|
+
|
|
124
|
+
@ApiPropertyOptional({
|
|
125
|
+
description:
|
|
126
|
+
'Procedimentos a gravar junto com o agendamento (analytics `appointment.created` inclui a lista)',
|
|
127
|
+
type: [AppointmentProcedureDto],
|
|
128
|
+
})
|
|
129
|
+
@IsOptional()
|
|
130
|
+
@IsArray()
|
|
131
|
+
@ValidateNested({ each: true })
|
|
132
|
+
@Type(() => AppointmentProcedureDto)
|
|
133
|
+
initialProcedures?: AppointmentProcedureDto[];
|
|
134
|
+
|
|
135
|
+
@ApiPropertyOptional({
|
|
136
|
+
description: 'Sinaliza que o fluxo de criação já pediu disparo de termo jurídico para o paciente',
|
|
137
|
+
default: false,
|
|
138
|
+
})
|
|
139
|
+
@IsOptional()
|
|
140
|
+
@IsBoolean()
|
|
141
|
+
legalTermRequested?: boolean;
|
|
142
|
+
|
|
143
|
+
@ApiPropertyOptional({
|
|
144
|
+
description:
|
|
145
|
+
'IDs de procedimentos (UUID) usados como contexto do termo jurídico solicitado na criação do agendamento',
|
|
146
|
+
type: [String],
|
|
147
|
+
format: 'uuid',
|
|
148
|
+
})
|
|
149
|
+
@IsOptional()
|
|
150
|
+
@IsArray()
|
|
151
|
+
@IsUUID('4', { each: true })
|
|
152
|
+
legalTermProcedureIds?: string[];
|
|
153
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './create-appointment.dto';
|
|
2
|
-
export * from './update-appointment.dto';
|
|
3
|
-
export * from './list-appointments-query.dto';
|
|
4
|
-
export * from './available-slots-query.dto';
|
|
5
|
-
export * from './available-slots-response.dto';
|
|
6
|
-
export * from './appointment-status.dto';
|
|
7
|
-
export * from './appointment.dto';
|
|
8
|
-
export * from './appointment-procedure.dto';
|
|
9
|
-
export * from './update-appointment-procedure.dto';
|
|
10
|
-
export * from './care-queue.dto';
|
|
1
|
+
export * from './create-appointment.dto';
|
|
2
|
+
export * from './update-appointment.dto';
|
|
3
|
+
export * from './list-appointments-query.dto';
|
|
4
|
+
export * from './available-slots-query.dto';
|
|
5
|
+
export * from './available-slots-response.dto';
|
|
6
|
+
export * from './appointment-status.dto';
|
|
7
|
+
export * from './appointment.dto';
|
|
8
|
+
export * from './appointment-procedure.dto';
|
|
9
|
+
export * from './update-appointment-procedure.dto';
|
|
10
|
+
export * from './care-queue.dto';
|
|
11
11
|
export * from './appointment-calendar.dto';
|
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { IsBoolean, IsDateString, IsIn, IsInt, IsOptional, IsString, IsUUID, Max, Min } from 'class-validator';
|
|
3
|
-
import type { ParsedFilterDto } from '../filters/parsed-filter.dto';
|
|
4
|
-
import { AppointmentDto } from './appointment.dto';
|
|
5
|
-
import { APPOINTMENT_STATUSES, AppointmentStatusDto } from './appointment-status.dto';
|
|
6
|
-
|
|
7
|
-
/** Colunas permitidas na listagem de agendamentos (camelCase). */
|
|
8
|
-
export const APPOINTMENT_LIST_FILTER_KEYS = [
|
|
9
|
-
'id',
|
|
10
|
-
'patientId',
|
|
11
|
-
'userId',
|
|
12
|
-
'date',
|
|
13
|
-
'checkinCompleted',
|
|
14
|
-
'checkoutCompleted',
|
|
15
|
-
'exitTime',
|
|
16
|
-
'observation',
|
|
17
|
-
'cancellationReason',
|
|
18
|
-
'status',
|
|
19
|
-
'appointmentType',
|
|
20
|
-
'rescheduledFromId',
|
|
21
|
-
'returnFromAppointmentId',
|
|
22
|
-
'createdAt',
|
|
23
|
-
'updatedAt',
|
|
24
|
-
] as const;
|
|
25
|
-
export type AppointmentListFilterKeyDto = (typeof APPOINTMENT_LIST_FILTER_KEYS)[number];
|
|
26
|
-
|
|
27
|
-
/** Campo principal de ordenação na listagem de agendamentos. */
|
|
28
|
-
export const APPOINTMENT_LIST_SORT_BY = [
|
|
29
|
-
'date',
|
|
30
|
-
'checkin_completed',
|
|
31
|
-
'checkout_completed',
|
|
32
|
-
] as const;
|
|
33
|
-
export type AppointmentListSortByDto = (typeof APPOINTMENT_LIST_SORT_BY)[number];
|
|
34
|
-
|
|
35
|
-
export const APPOINTMENT_LIST_SORT_ORDER = ['ASC', 'DESC'] as const;
|
|
36
|
-
export type AppointmentListSortOrderDto = (typeof APPOINTMENT_LIST_SORT_ORDER)[number];
|
|
37
|
-
|
|
38
|
-
export class ListAppointmentsQueryDto {
|
|
39
|
-
@ApiPropertyOptional({
|
|
40
|
-
description: 'Número da página (iniciando em 1)',
|
|
41
|
-
example: 1,
|
|
42
|
-
minimum: 1,
|
|
43
|
-
default: 1,
|
|
44
|
-
})
|
|
45
|
-
@IsOptional()
|
|
46
|
-
@IsInt()
|
|
47
|
-
@Min(1)
|
|
48
|
-
page?: number;
|
|
49
|
-
|
|
50
|
-
@ApiPropertyOptional({
|
|
51
|
-
description: 'Quantidade de registros por página',
|
|
52
|
-
example: 20,
|
|
53
|
-
minimum: 1,
|
|
54
|
-
maximum: 100,
|
|
55
|
-
default: 20,
|
|
56
|
-
})
|
|
57
|
-
@IsOptional()
|
|
58
|
-
@IsInt()
|
|
59
|
-
@Min(1)
|
|
60
|
-
@Max(100)
|
|
61
|
-
limit?: number;
|
|
62
|
-
|
|
63
|
-
@ApiPropertyOptional({
|
|
64
|
-
description: 'Filtrar agendamentos a partir desta data (ISO 8601)',
|
|
65
|
-
example: '2026-03-01T00:00:00.000Z',
|
|
66
|
-
})
|
|
67
|
-
@IsOptional()
|
|
68
|
-
@IsDateString()
|
|
69
|
-
dateFrom?: string;
|
|
70
|
-
|
|
71
|
-
@ApiPropertyOptional({
|
|
72
|
-
description: 'Filtrar agendamentos até esta data (ISO 8601)',
|
|
73
|
-
example: '2026-03-31T23:59:59.999Z',
|
|
74
|
-
})
|
|
75
|
-
@IsOptional()
|
|
76
|
-
@IsDateString()
|
|
77
|
-
dateTo?: string;
|
|
78
|
-
|
|
79
|
-
@ApiPropertyOptional({
|
|
80
|
-
description: 'Filtrar por profissional (UUID)',
|
|
81
|
-
example: '550e8400-e29b-41d4-a716-446655440001',
|
|
82
|
-
})
|
|
83
|
-
@IsOptional()
|
|
84
|
-
@IsUUID('4')
|
|
85
|
-
userId?: string;
|
|
86
|
-
|
|
87
|
-
@ApiPropertyOptional({
|
|
88
|
-
description: 'Filtrar por status de check-in realizado',
|
|
89
|
-
example: true,
|
|
90
|
-
})
|
|
91
|
-
@IsOptional()
|
|
92
|
-
@IsBoolean()
|
|
93
|
-
checkinCompleted?: boolean;
|
|
94
|
-
|
|
95
|
-
@ApiPropertyOptional({
|
|
96
|
-
description: 'Filtrar por status de check-out realizado',
|
|
97
|
-
example: false,
|
|
98
|
-
})
|
|
99
|
-
@IsOptional()
|
|
100
|
-
@IsBoolean()
|
|
101
|
-
checkoutCompleted?: boolean;
|
|
102
|
-
|
|
103
|
-
@ApiPropertyOptional({
|
|
104
|
-
description: 'Filtrar por paciente (UUID) - histórico de consultas',
|
|
105
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
106
|
-
})
|
|
107
|
-
@IsOptional()
|
|
108
|
-
@IsUUID('4')
|
|
109
|
-
patientId?: string;
|
|
110
|
-
|
|
111
|
-
@ApiPropertyOptional({
|
|
112
|
-
description: 'Filtrar por status do agendamento',
|
|
113
|
-
example: 'processing',
|
|
114
|
-
enum: APPOINTMENT_STATUSES,
|
|
115
|
-
})
|
|
116
|
-
@IsOptional()
|
|
117
|
-
@IsString()
|
|
118
|
-
@IsIn(APPOINTMENT_STATUSES)
|
|
119
|
-
status?: AppointmentStatusDto;
|
|
120
|
-
|
|
121
|
-
@ApiPropertyOptional({
|
|
122
|
-
description:
|
|
123
|
-
'Ordenação principal: `date`, `checkin_completed` (check-in pendente vs concluído) ou `checkout_completed` (check-out pendente vs concluído). Omisso = `date`.',
|
|
124
|
-
enum: APPOINTMENT_LIST_SORT_BY,
|
|
125
|
-
example: 'checkin_completed',
|
|
126
|
-
})
|
|
127
|
-
@IsOptional()
|
|
128
|
-
@IsIn(APPOINTMENT_LIST_SORT_BY)
|
|
129
|
-
sortBy?: AppointmentListSortByDto;
|
|
130
|
-
|
|
131
|
-
@ApiPropertyOptional({
|
|
132
|
-
description:
|
|
133
|
-
'Direção: `ASC` ou `DESC`. Com `checkin_completed` ou `checkout_completed`, `ASC` coloca pendentes (false) primeiro; `DESC` coloca concluídos (true) primeiro. Com `date`, aplica-se à coluna `date`.',
|
|
134
|
-
enum: APPOINTMENT_LIST_SORT_ORDER,
|
|
135
|
-
example: 'ASC',
|
|
136
|
-
})
|
|
137
|
-
@IsOptional()
|
|
138
|
-
@IsIn(APPOINTMENT_LIST_SORT_ORDER)
|
|
139
|
-
sortOrder?: AppointmentListSortOrderDto;
|
|
140
|
-
|
|
141
|
-
@ApiPropertyOptional({
|
|
142
|
-
description:
|
|
143
|
-
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
144
|
-
'Example: `[{"key":"status","op":"==","value":"pending"}]`. ' +
|
|
145
|
-
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
146
|
-
type: String,
|
|
147
|
-
example: '[{"key":"status","op":"==","value":"pending"}]',
|
|
148
|
-
})
|
|
149
|
-
@IsOptional()
|
|
150
|
-
filters?: ParsedFilterDto[];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface AppointmentListResult {
|
|
154
|
-
items: AppointmentDto[];
|
|
155
|
-
total: number;
|
|
156
|
-
page: number;
|
|
157
|
-
limit: number;
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsBoolean, IsDateString, IsIn, IsInt, IsOptional, IsString, IsUUID, Max, Min } from 'class-validator';
|
|
3
|
+
import type { ParsedFilterDto } from '../filters/parsed-filter.dto';
|
|
4
|
+
import { AppointmentDto } from './appointment.dto';
|
|
5
|
+
import { APPOINTMENT_STATUSES, AppointmentStatusDto } from './appointment-status.dto';
|
|
6
|
+
|
|
7
|
+
/** Colunas permitidas na listagem de agendamentos (camelCase). */
|
|
8
|
+
export const APPOINTMENT_LIST_FILTER_KEYS = [
|
|
9
|
+
'id',
|
|
10
|
+
'patientId',
|
|
11
|
+
'userId',
|
|
12
|
+
'date',
|
|
13
|
+
'checkinCompleted',
|
|
14
|
+
'checkoutCompleted',
|
|
15
|
+
'exitTime',
|
|
16
|
+
'observation',
|
|
17
|
+
'cancellationReason',
|
|
18
|
+
'status',
|
|
19
|
+
'appointmentType',
|
|
20
|
+
'rescheduledFromId',
|
|
21
|
+
'returnFromAppointmentId',
|
|
22
|
+
'createdAt',
|
|
23
|
+
'updatedAt',
|
|
24
|
+
] as const;
|
|
25
|
+
export type AppointmentListFilterKeyDto = (typeof APPOINTMENT_LIST_FILTER_KEYS)[number];
|
|
26
|
+
|
|
27
|
+
/** Campo principal de ordenação na listagem de agendamentos. */
|
|
28
|
+
export const APPOINTMENT_LIST_SORT_BY = [
|
|
29
|
+
'date',
|
|
30
|
+
'checkin_completed',
|
|
31
|
+
'checkout_completed',
|
|
32
|
+
] as const;
|
|
33
|
+
export type AppointmentListSortByDto = (typeof APPOINTMENT_LIST_SORT_BY)[number];
|
|
34
|
+
|
|
35
|
+
export const APPOINTMENT_LIST_SORT_ORDER = ['ASC', 'DESC'] as const;
|
|
36
|
+
export type AppointmentListSortOrderDto = (typeof APPOINTMENT_LIST_SORT_ORDER)[number];
|
|
37
|
+
|
|
38
|
+
export class ListAppointmentsQueryDto {
|
|
39
|
+
@ApiPropertyOptional({
|
|
40
|
+
description: 'Número da página (iniciando em 1)',
|
|
41
|
+
example: 1,
|
|
42
|
+
minimum: 1,
|
|
43
|
+
default: 1,
|
|
44
|
+
})
|
|
45
|
+
@IsOptional()
|
|
46
|
+
@IsInt()
|
|
47
|
+
@Min(1)
|
|
48
|
+
page?: number;
|
|
49
|
+
|
|
50
|
+
@ApiPropertyOptional({
|
|
51
|
+
description: 'Quantidade de registros por página',
|
|
52
|
+
example: 20,
|
|
53
|
+
minimum: 1,
|
|
54
|
+
maximum: 100,
|
|
55
|
+
default: 20,
|
|
56
|
+
})
|
|
57
|
+
@IsOptional()
|
|
58
|
+
@IsInt()
|
|
59
|
+
@Min(1)
|
|
60
|
+
@Max(100)
|
|
61
|
+
limit?: number;
|
|
62
|
+
|
|
63
|
+
@ApiPropertyOptional({
|
|
64
|
+
description: 'Filtrar agendamentos a partir desta data (ISO 8601)',
|
|
65
|
+
example: '2026-03-01T00:00:00.000Z',
|
|
66
|
+
})
|
|
67
|
+
@IsOptional()
|
|
68
|
+
@IsDateString()
|
|
69
|
+
dateFrom?: string;
|
|
70
|
+
|
|
71
|
+
@ApiPropertyOptional({
|
|
72
|
+
description: 'Filtrar agendamentos até esta data (ISO 8601)',
|
|
73
|
+
example: '2026-03-31T23:59:59.999Z',
|
|
74
|
+
})
|
|
75
|
+
@IsOptional()
|
|
76
|
+
@IsDateString()
|
|
77
|
+
dateTo?: string;
|
|
78
|
+
|
|
79
|
+
@ApiPropertyOptional({
|
|
80
|
+
description: 'Filtrar por profissional (UUID)',
|
|
81
|
+
example: '550e8400-e29b-41d4-a716-446655440001',
|
|
82
|
+
})
|
|
83
|
+
@IsOptional()
|
|
84
|
+
@IsUUID('4')
|
|
85
|
+
userId?: string;
|
|
86
|
+
|
|
87
|
+
@ApiPropertyOptional({
|
|
88
|
+
description: 'Filtrar por status de check-in realizado',
|
|
89
|
+
example: true,
|
|
90
|
+
})
|
|
91
|
+
@IsOptional()
|
|
92
|
+
@IsBoolean()
|
|
93
|
+
checkinCompleted?: boolean;
|
|
94
|
+
|
|
95
|
+
@ApiPropertyOptional({
|
|
96
|
+
description: 'Filtrar por status de check-out realizado',
|
|
97
|
+
example: false,
|
|
98
|
+
})
|
|
99
|
+
@IsOptional()
|
|
100
|
+
@IsBoolean()
|
|
101
|
+
checkoutCompleted?: boolean;
|
|
102
|
+
|
|
103
|
+
@ApiPropertyOptional({
|
|
104
|
+
description: 'Filtrar por paciente (UUID) - histórico de consultas',
|
|
105
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
106
|
+
})
|
|
107
|
+
@IsOptional()
|
|
108
|
+
@IsUUID('4')
|
|
109
|
+
patientId?: string;
|
|
110
|
+
|
|
111
|
+
@ApiPropertyOptional({
|
|
112
|
+
description: 'Filtrar por status do agendamento',
|
|
113
|
+
example: 'processing',
|
|
114
|
+
enum: APPOINTMENT_STATUSES,
|
|
115
|
+
})
|
|
116
|
+
@IsOptional()
|
|
117
|
+
@IsString()
|
|
118
|
+
@IsIn(APPOINTMENT_STATUSES)
|
|
119
|
+
status?: AppointmentStatusDto;
|
|
120
|
+
|
|
121
|
+
@ApiPropertyOptional({
|
|
122
|
+
description:
|
|
123
|
+
'Ordenação principal: `date`, `checkin_completed` (check-in pendente vs concluído) ou `checkout_completed` (check-out pendente vs concluído). Omisso = `date`.',
|
|
124
|
+
enum: APPOINTMENT_LIST_SORT_BY,
|
|
125
|
+
example: 'checkin_completed',
|
|
126
|
+
})
|
|
127
|
+
@IsOptional()
|
|
128
|
+
@IsIn(APPOINTMENT_LIST_SORT_BY)
|
|
129
|
+
sortBy?: AppointmentListSortByDto;
|
|
130
|
+
|
|
131
|
+
@ApiPropertyOptional({
|
|
132
|
+
description:
|
|
133
|
+
'Direção: `ASC` ou `DESC`. Com `checkin_completed` ou `checkout_completed`, `ASC` coloca pendentes (false) primeiro; `DESC` coloca concluídos (true) primeiro. Com `date`, aplica-se à coluna `date`.',
|
|
134
|
+
enum: APPOINTMENT_LIST_SORT_ORDER,
|
|
135
|
+
example: 'ASC',
|
|
136
|
+
})
|
|
137
|
+
@IsOptional()
|
|
138
|
+
@IsIn(APPOINTMENT_LIST_SORT_ORDER)
|
|
139
|
+
sortOrder?: AppointmentListSortOrderDto;
|
|
140
|
+
|
|
141
|
+
@ApiPropertyOptional({
|
|
142
|
+
description:
|
|
143
|
+
'JSON string with an array of filter objects `{ key, op, value }`. ' +
|
|
144
|
+
'Example: `[{"key":"status","op":"==","value":"pending"}]`. ' +
|
|
145
|
+
'Ops: ==, !=, >, <, >=, <=, in (value must be array for `in`), like, unlike (string pattern).',
|
|
146
|
+
type: String,
|
|
147
|
+
example: '[{"key":"status","op":"==","value":"pending"}]',
|
|
148
|
+
})
|
|
149
|
+
@IsOptional()
|
|
150
|
+
filters?: ParsedFilterDto[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface AppointmentListResult {
|
|
154
|
+
items: AppointmentDto[];
|
|
155
|
+
total: number;
|
|
156
|
+
page: number;
|
|
157
|
+
limit: number;
|
|
158
158
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/swagger';
|
|
2
|
-
import { AppointmentProcedureDto } from './appointment-procedure.dto';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DTO for partially updating an appointment procedure.
|
|
6
|
-
* All fields are optional.
|
|
7
|
-
*/
|
|
8
|
-
export class UpdateAppointmentProcedureDto extends PartialType(
|
|
9
|
-
AppointmentProcedureDto,
|
|
10
|
-
) {}
|
|
1
|
+
import { PartialType } from '@nestjs/swagger';
|
|
2
|
+
import { AppointmentProcedureDto } from './appointment-procedure.dto';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DTO for partially updating an appointment procedure.
|
|
6
|
+
* All fields are optional.
|
|
7
|
+
*/
|
|
8
|
+
export class UpdateAppointmentProcedureDto extends PartialType(
|
|
9
|
+
AppointmentProcedureDto,
|
|
10
|
+
) {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/swagger';
|
|
2
|
-
import { CreateAppointmentDto } from './create-appointment.dto';
|
|
3
|
-
|
|
4
|
-
export class UpdateAppointmentDto extends PartialType(CreateAppointmentDto) {}
|
|
1
|
+
import { PartialType } from '@nestjs/swagger';
|
|
2
|
+
import { CreateAppointmentDto } from './create-appointment.dto';
|
|
3
|
+
|
|
4
|
+
export class UpdateAppointmentDto extends PartialType(CreateAppointmentDto) {}
|