tychat-contracts 1.0.97 → 1.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appointments/list-appointments-query.dto.d.ts +2 -1
- package/dist/appointments/list-appointments-query.dto.d.ts.map +1 -1
- package/dist/appointments/list-appointments-query.dto.js +17 -3
- package/dist/conversations/index.d.ts +2 -0
- package/dist/conversations/index.d.ts.map +1 -1
- package/dist/conversations/index.js +2 -0
- package/dist/conversations/list-conversation-contacts-filters.dto.d.ts +20 -0
- package/dist/conversations/list-conversation-contacts-filters.dto.d.ts.map +1 -0
- package/dist/conversations/list-conversation-contacts-filters.dto.js +91 -0
- package/dist/conversations/list-conversation-contacts-query.dto.d.ts +7 -0
- package/dist/conversations/list-conversation-contacts-query.dto.d.ts.map +1 -0
- package/dist/conversations/list-conversation-contacts-query.dto.js +83 -0
- package/package.json +1 -1
- package/src/appointments/list-appointments-query.dto.ts +15 -3
- package/src/conversations/index.ts +2 -0
- package/src/conversations/list-conversation-contacts-filters.dto.ts +91 -0
- package/src/conversations/list-conversation-contacts-query.dto.ts +75 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppointmentDto } from './appointment.dto';
|
|
2
2
|
import { AppointmentStatusDto } from './appointment-status.dto';
|
|
3
3
|
/** Campo principal de ordenação na listagem de agendamentos. */
|
|
4
|
-
export declare const APPOINTMENT_LIST_SORT_BY: readonly ["date", "checkin_completed"];
|
|
4
|
+
export declare const APPOINTMENT_LIST_SORT_BY: readonly ["date", "checkin_completed", "checkout_completed"];
|
|
5
5
|
export type AppointmentListSortByDto = (typeof APPOINTMENT_LIST_SORT_BY)[number];
|
|
6
6
|
export declare const APPOINTMENT_LIST_SORT_ORDER: readonly ["ASC", "DESC"];
|
|
7
7
|
export type AppointmentListSortOrderDto = (typeof APPOINTMENT_LIST_SORT_ORDER)[number];
|
|
@@ -12,6 +12,7 @@ export declare class ListAppointmentsQueryDto {
|
|
|
12
12
|
dateTo?: string;
|
|
13
13
|
userId?: string;
|
|
14
14
|
checkinCompleted?: boolean;
|
|
15
|
+
checkoutCompleted?: boolean;
|
|
15
16
|
patientId?: string;
|
|
16
17
|
status?: AppointmentStatusDto;
|
|
17
18
|
sortBy?: AppointmentListSortByDto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-appointments-query.dto.d.ts","sourceRoot":"","sources":["../../src/appointments/list-appointments-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAwB,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"list-appointments-query.dto.d.ts","sourceRoot":"","sources":["../../src/appointments/list-appointments-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAwB,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,8DAI3B,CAAC;AACX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,eAAO,MAAM,2BAA2B,0BAA2B,CAAC;AACpE,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvF,qBAAa,wBAAwB;IAUnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;IAQf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAQlB,MAAM,CAAC,EAAE,MAAM,CAAC;IAQhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAQhB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAQ3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAQ5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAUnB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAU9B,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAUlC,SAAS,CAAC,EAAE,2BAA2B,CAAC;CACzC;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -14,7 +14,11 @@ const swagger_1 = require("@nestjs/swagger");
|
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const appointment_status_dto_1 = require("./appointment-status.dto");
|
|
16
16
|
/** Campo principal de ordenação na listagem de agendamentos. */
|
|
17
|
-
exports.APPOINTMENT_LIST_SORT_BY = [
|
|
17
|
+
exports.APPOINTMENT_LIST_SORT_BY = [
|
|
18
|
+
'date',
|
|
19
|
+
'checkin_completed',
|
|
20
|
+
'checkout_completed',
|
|
21
|
+
];
|
|
18
22
|
exports.APPOINTMENT_LIST_SORT_ORDER = ['ASC', 'DESC'];
|
|
19
23
|
class ListAppointmentsQueryDto {
|
|
20
24
|
page;
|
|
@@ -23,6 +27,7 @@ class ListAppointmentsQueryDto {
|
|
|
23
27
|
dateTo;
|
|
24
28
|
userId;
|
|
25
29
|
checkinCompleted;
|
|
30
|
+
checkoutCompleted;
|
|
26
31
|
patientId;
|
|
27
32
|
status;
|
|
28
33
|
sortBy;
|
|
@@ -91,6 +96,15 @@ __decorate([
|
|
|
91
96
|
(0, class_validator_1.IsBoolean)(),
|
|
92
97
|
__metadata("design:type", Boolean)
|
|
93
98
|
], ListAppointmentsQueryDto.prototype, "checkinCompleted", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
101
|
+
description: 'Filtrar por status de check-out realizado',
|
|
102
|
+
example: false,
|
|
103
|
+
}),
|
|
104
|
+
(0, class_validator_1.IsOptional)(),
|
|
105
|
+
(0, class_validator_1.IsBoolean)(),
|
|
106
|
+
__metadata("design:type", Boolean)
|
|
107
|
+
], ListAppointmentsQueryDto.prototype, "checkoutCompleted", void 0);
|
|
94
108
|
__decorate([
|
|
95
109
|
(0, swagger_1.ApiPropertyOptional)({
|
|
96
110
|
description: 'Filtrar por paciente (UUID) - histórico de consultas',
|
|
@@ -113,7 +127,7 @@ __decorate([
|
|
|
113
127
|
], ListAppointmentsQueryDto.prototype, "status", void 0);
|
|
114
128
|
__decorate([
|
|
115
129
|
(0, swagger_1.ApiPropertyOptional)({
|
|
116
|
-
description: 'Ordenação principal: `date` (
|
|
130
|
+
description: 'Ordenação principal: `date`, `checkin_completed` (check-in pendente vs concluído) ou `checkout_completed` (check-out pendente vs concluído). Omisso = `date`.',
|
|
117
131
|
enum: exports.APPOINTMENT_LIST_SORT_BY,
|
|
118
132
|
example: 'checkin_completed',
|
|
119
133
|
}),
|
|
@@ -123,7 +137,7 @@ __decorate([
|
|
|
123
137
|
], ListAppointmentsQueryDto.prototype, "sortBy", void 0);
|
|
124
138
|
__decorate([
|
|
125
139
|
(0, swagger_1.ApiPropertyOptional)({
|
|
126
|
-
description: 'Direção: `ASC` ou `DESC`. Com `
|
|
140
|
+
description: '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`.',
|
|
127
141
|
enum: exports.APPOINTMENT_LIST_SORT_ORDER,
|
|
128
142
|
example: 'ASC',
|
|
129
143
|
}),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './conversation-type.dto';
|
|
2
2
|
export * from './conversation-intention.dto';
|
|
3
|
+
export * from './list-conversation-contacts-filters.dto';
|
|
4
|
+
export * from './list-conversation-contacts-query.dto';
|
|
3
5
|
export * from './create-conversation-session.dto';
|
|
4
6
|
export * from './conversation-session-response.dto';
|
|
5
7
|
export * from './create-conversation.dto';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversations/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversations/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
|
|
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./conversation-type.dto"), exports);
|
|
18
18
|
__exportStar(require("./conversation-intention.dto"), exports);
|
|
19
|
+
__exportStar(require("./list-conversation-contacts-filters.dto"), exports);
|
|
20
|
+
__exportStar(require("./list-conversation-contacts-query.dto"), exports);
|
|
19
21
|
__exportStar(require("./create-conversation-session.dto"), exports);
|
|
20
22
|
__exportStar(require("./conversation-session-response.dto"), exports);
|
|
21
23
|
__exportStar(require("./create-conversation.dto"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
+
/** Campos da sessão (`conversation_sessions`) em `filters[].key` (camelCase da API). */
|
|
3
|
+
export declare const CONVERSATION_CONTACT_LIST_FILTER_KEYS: readonly ["id", "sessionUuid", "patientId", "unitId", "tenantEvogoInstanceId", "conversationType", "intention", "unreadCount", "startedAt", "expiresAt"];
|
|
4
|
+
export type ConversationContactListFilterKeyDto = (typeof CONVERSATION_CONTACT_LIST_FILTER_KEYS)[number];
|
|
5
|
+
export declare const CONVERSATION_CONTACT_LIST_FILTER_OPS: readonly ["==", ">", "<", ">=", "<=", "!=", "in"];
|
|
6
|
+
export type ConversationContactListFilterOpDto = (typeof CONVERSATION_CONTACT_LIST_FILTER_OPS)[number];
|
|
7
|
+
export declare class ConversationContactListFilterValueConstraint implements ValidatorConstraintInterface {
|
|
8
|
+
validate(value: unknown, args: ValidationArguments): boolean;
|
|
9
|
+
defaultMessage(): string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Critério de filtro na listagem de contatos (sessão mais recente por paciente).
|
|
13
|
+
* Apenas `key`, `op` e `value`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ConversationContactListFilterDto {
|
|
16
|
+
key: ConversationContactListFilterKeyDto;
|
|
17
|
+
op: ConversationContactListFilterOpDto;
|
|
18
|
+
value: unknown;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=list-conversation-contacts-filters.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-conversation-contacts-filters.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-filters.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAML,mBAAmB,EAEnB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AAEzB,wFAAwF;AACxF,eAAO,MAAM,qCAAqC,0JAWxC,CAAC;AACX,MAAM,MAAM,mCAAmC,GAC7C,CAAC,OAAO,qCAAqC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,oCAAoC,mDAQvC,CAAC;AACX,MAAM,MAAM,kCAAkC,GAC5C,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,qBACa,4CACX,YAAW,4BAA4B;IAEvC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO;IAS5D,cAAc,IAAI,MAAM;CAKzB;AAED;;;GAGG;AACH,qBAAa,gCAAgC;IAQ3C,GAAG,EAAE,mCAAmC,CAAC;IASzC,EAAE,EAAE,kCAAkC,CAAC;IAQvC,KAAK,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ConversationContactListFilterDto = exports.ConversationContactListFilterValueConstraint = exports.CONVERSATION_CONTACT_LIST_FILTER_OPS = exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
/** Campos da sessão (`conversation_sessions`) em `filters[].key` (camelCase da API). */
|
|
16
|
+
exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS = [
|
|
17
|
+
'id',
|
|
18
|
+
'sessionUuid',
|
|
19
|
+
'patientId',
|
|
20
|
+
'unitId',
|
|
21
|
+
'tenantEvogoInstanceId',
|
|
22
|
+
'conversationType',
|
|
23
|
+
'intention',
|
|
24
|
+
'unreadCount',
|
|
25
|
+
'startedAt',
|
|
26
|
+
'expiresAt',
|
|
27
|
+
];
|
|
28
|
+
exports.CONVERSATION_CONTACT_LIST_FILTER_OPS = [
|
|
29
|
+
'==',
|
|
30
|
+
'>',
|
|
31
|
+
'<',
|
|
32
|
+
'>=',
|
|
33
|
+
'<=',
|
|
34
|
+
'!=',
|
|
35
|
+
'in',
|
|
36
|
+
];
|
|
37
|
+
let ConversationContactListFilterValueConstraint = class ConversationContactListFilterValueConstraint {
|
|
38
|
+
validate(value, args) {
|
|
39
|
+
const obj = args.object;
|
|
40
|
+
const op = obj?.op;
|
|
41
|
+
if (op === 'in') {
|
|
42
|
+
return Array.isArray(value) && value.length >= 1;
|
|
43
|
+
}
|
|
44
|
+
return !Array.isArray(value);
|
|
45
|
+
}
|
|
46
|
+
defaultMessage() {
|
|
47
|
+
return ('Para op "in", value deve ser um array não vazio; para as demais operações, value não pode ser array');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.ConversationContactListFilterValueConstraint = ConversationContactListFilterValueConstraint;
|
|
51
|
+
exports.ConversationContactListFilterValueConstraint = ConversationContactListFilterValueConstraint = __decorate([
|
|
52
|
+
(0, class_validator_1.ValidatorConstraint)({ name: 'conversationContactListFilterValueShape', async: false })
|
|
53
|
+
], ConversationContactListFilterValueConstraint);
|
|
54
|
+
/**
|
|
55
|
+
* Critério de filtro na listagem de contatos (sessão mais recente por paciente).
|
|
56
|
+
* Apenas `key`, `op` e `value`.
|
|
57
|
+
*/
|
|
58
|
+
class ConversationContactListFilterDto {
|
|
59
|
+
key;
|
|
60
|
+
op;
|
|
61
|
+
value;
|
|
62
|
+
}
|
|
63
|
+
exports.ConversationContactListFilterDto = ConversationContactListFilterDto;
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, swagger_1.ApiProperty)({
|
|
66
|
+
description: 'Campo da sessão (camelCase)',
|
|
67
|
+
enum: exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS,
|
|
68
|
+
example: 'patientId',
|
|
69
|
+
}),
|
|
70
|
+
(0, class_validator_1.IsString)(),
|
|
71
|
+
(0, class_validator_1.IsIn)(exports.CONVERSATION_CONTACT_LIST_FILTER_KEYS),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], ConversationContactListFilterDto.prototype, "key", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, swagger_1.ApiProperty)({
|
|
76
|
+
description: 'Operador de comparação',
|
|
77
|
+
enum: exports.CONVERSATION_CONTACT_LIST_FILTER_OPS,
|
|
78
|
+
example: '==',
|
|
79
|
+
}),
|
|
80
|
+
(0, class_validator_1.IsString)(),
|
|
81
|
+
(0, class_validator_1.IsIn)(exports.CONVERSATION_CONTACT_LIST_FILTER_OPS),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], ConversationContactListFilterDto.prototype, "op", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
86
|
+
description: 'Valor escalar ou, com op "in", array. null permitido para == / != em colunas opcionais (ex.: intention, unitId).',
|
|
87
|
+
example: '00000000-0000-4000-8000-000000000000',
|
|
88
|
+
}),
|
|
89
|
+
(0, class_validator_1.Validate)(ConversationContactListFilterValueConstraint),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], ConversationContactListFilterDto.prototype, "value", void 0);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConversationContactListFilterDto } from './list-conversation-contacts-filters.dto';
|
|
2
|
+
export declare class ListConversationContactsQueryDto {
|
|
3
|
+
page?: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
filters?: ConversationContactListFilterDto[];
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=list-conversation-contacts-query.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-conversation-contacts-query.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-query.dto.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAyB5F,qBAAa,gCAAgC;IAU3C,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;IAcf,OAAO,CAAC,EAAE,gCAAgC,EAAE,CAAC;CAC9C"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ListConversationContactsQueryDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const list_conversation_contacts_filters_dto_1 = require("./list-conversation-contacts-filters.dto");
|
|
17
|
+
function parseFiltersFromQuery(value) {
|
|
18
|
+
if (value === undefined || value === null || value === '') {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === 'string') {
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse(value);
|
|
27
|
+
if (!Array.isArray(parsed)) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
class ListConversationContactsQueryDto {
|
|
39
|
+
page;
|
|
40
|
+
limit;
|
|
41
|
+
filters;
|
|
42
|
+
}
|
|
43
|
+
exports.ListConversationContactsQueryDto = ListConversationContactsQueryDto;
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
46
|
+
description: 'Número da página (iniciando em 1)',
|
|
47
|
+
example: 1,
|
|
48
|
+
minimum: 1,
|
|
49
|
+
default: 1,
|
|
50
|
+
}),
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_validator_1.IsInt)(),
|
|
53
|
+
(0, class_validator_1.Min)(1),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], ListConversationContactsQueryDto.prototype, "page", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
58
|
+
description: 'Registros por página',
|
|
59
|
+
example: 20,
|
|
60
|
+
minimum: 1,
|
|
61
|
+
maximum: 100,
|
|
62
|
+
default: 20,
|
|
63
|
+
}),
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
(0, class_validator_1.IsInt)(),
|
|
66
|
+
(0, class_validator_1.Min)(1),
|
|
67
|
+
(0, class_validator_1.Max)(100),
|
|
68
|
+
__metadata("design:type", Number)
|
|
69
|
+
], ListConversationContactsQueryDto.prototype, "limit", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
72
|
+
description: 'Lista `{ key, op, value }`. Na query HTTP: string JSON (ex.: `[{"key":"conversationType","op":"==","value":"ia"}]`). Ops: ==, !=, >, <, >=, <=, in.',
|
|
73
|
+
type: [list_conversation_contacts_filters_dto_1.ConversationContactListFilterDto],
|
|
74
|
+
isArray: true,
|
|
75
|
+
}),
|
|
76
|
+
(0, class_validator_1.IsOptional)(),
|
|
77
|
+
(0, class_transformer_1.Transform)(({ value }) => parseFiltersFromQuery(value)),
|
|
78
|
+
(0, class_validator_1.IsArray)(),
|
|
79
|
+
(0, class_validator_1.ArrayMinSize)(0),
|
|
80
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
81
|
+
(0, class_transformer_1.Type)(() => list_conversation_contacts_filters_dto_1.ConversationContactListFilterDto),
|
|
82
|
+
__metadata("design:type", Array)
|
|
83
|
+
], ListConversationContactsQueryDto.prototype, "filters", void 0);
|
package/package.json
CHANGED
|
@@ -4,7 +4,11 @@ import { AppointmentDto } from './appointment.dto';
|
|
|
4
4
|
import { APPOINTMENT_STATUSES, AppointmentStatusDto } from './appointment-status.dto';
|
|
5
5
|
|
|
6
6
|
/** Campo principal de ordenação na listagem de agendamentos. */
|
|
7
|
-
export const APPOINTMENT_LIST_SORT_BY = [
|
|
7
|
+
export const APPOINTMENT_LIST_SORT_BY = [
|
|
8
|
+
'date',
|
|
9
|
+
'checkin_completed',
|
|
10
|
+
'checkout_completed',
|
|
11
|
+
] as const;
|
|
8
12
|
export type AppointmentListSortByDto = (typeof APPOINTMENT_LIST_SORT_BY)[number];
|
|
9
13
|
|
|
10
14
|
export const APPOINTMENT_LIST_SORT_ORDER = ['ASC', 'DESC'] as const;
|
|
@@ -67,6 +71,14 @@ export class ListAppointmentsQueryDto {
|
|
|
67
71
|
@IsBoolean()
|
|
68
72
|
checkinCompleted?: boolean;
|
|
69
73
|
|
|
74
|
+
@ApiPropertyOptional({
|
|
75
|
+
description: 'Filtrar por status de check-out realizado',
|
|
76
|
+
example: false,
|
|
77
|
+
})
|
|
78
|
+
@IsOptional()
|
|
79
|
+
@IsBoolean()
|
|
80
|
+
checkoutCompleted?: boolean;
|
|
81
|
+
|
|
70
82
|
@ApiPropertyOptional({
|
|
71
83
|
description: 'Filtrar por paciente (UUID) - histórico de consultas',
|
|
72
84
|
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
@@ -87,7 +99,7 @@ export class ListAppointmentsQueryDto {
|
|
|
87
99
|
|
|
88
100
|
@ApiPropertyOptional({
|
|
89
101
|
description:
|
|
90
|
-
'Ordenação principal: `date` (
|
|
102
|
+
'Ordenação principal: `date`, `checkin_completed` (check-in pendente vs concluído) ou `checkout_completed` (check-out pendente vs concluído). Omisso = `date`.',
|
|
91
103
|
enum: APPOINTMENT_LIST_SORT_BY,
|
|
92
104
|
example: 'checkin_completed',
|
|
93
105
|
})
|
|
@@ -97,7 +109,7 @@ export class ListAppointmentsQueryDto {
|
|
|
97
109
|
|
|
98
110
|
@ApiPropertyOptional({
|
|
99
111
|
description:
|
|
100
|
-
'Direção: `ASC` ou `DESC`. Com `
|
|
112
|
+
'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`.',
|
|
101
113
|
enum: APPOINTMENT_LIST_SORT_ORDER,
|
|
102
114
|
example: 'ASC',
|
|
103
115
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './conversation-type.dto';
|
|
2
2
|
export * from './conversation-intention.dto';
|
|
3
|
+
export * from './list-conversation-contacts-filters.dto';
|
|
4
|
+
export * from './list-conversation-contacts-query.dto';
|
|
3
5
|
export * from './create-conversation-session.dto';
|
|
4
6
|
export * from './conversation-session-response.dto';
|
|
5
7
|
export * from './create-conversation.dto';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import {
|
|
3
|
+
ArrayMinSize,
|
|
4
|
+
IsArray,
|
|
5
|
+
IsIn,
|
|
6
|
+
IsString,
|
|
7
|
+
Validate,
|
|
8
|
+
ValidationArguments,
|
|
9
|
+
ValidatorConstraint,
|
|
10
|
+
ValidatorConstraintInterface,
|
|
11
|
+
} from 'class-validator';
|
|
12
|
+
|
|
13
|
+
/** Campos da sessão (`conversation_sessions`) em `filters[].key` (camelCase da API). */
|
|
14
|
+
export const CONVERSATION_CONTACT_LIST_FILTER_KEYS = [
|
|
15
|
+
'id',
|
|
16
|
+
'sessionUuid',
|
|
17
|
+
'patientId',
|
|
18
|
+
'unitId',
|
|
19
|
+
'tenantEvogoInstanceId',
|
|
20
|
+
'conversationType',
|
|
21
|
+
'intention',
|
|
22
|
+
'unreadCount',
|
|
23
|
+
'startedAt',
|
|
24
|
+
'expiresAt',
|
|
25
|
+
] as const;
|
|
26
|
+
export type ConversationContactListFilterKeyDto =
|
|
27
|
+
(typeof CONVERSATION_CONTACT_LIST_FILTER_KEYS)[number];
|
|
28
|
+
|
|
29
|
+
export const CONVERSATION_CONTACT_LIST_FILTER_OPS = [
|
|
30
|
+
'==',
|
|
31
|
+
'>',
|
|
32
|
+
'<',
|
|
33
|
+
'>=',
|
|
34
|
+
'<=',
|
|
35
|
+
'!=',
|
|
36
|
+
'in',
|
|
37
|
+
] as const;
|
|
38
|
+
export type ConversationContactListFilterOpDto =
|
|
39
|
+
(typeof CONVERSATION_CONTACT_LIST_FILTER_OPS)[number];
|
|
40
|
+
|
|
41
|
+
@ValidatorConstraint({ name: 'conversationContactListFilterValueShape', async: false })
|
|
42
|
+
export class ConversationContactListFilterValueConstraint
|
|
43
|
+
implements ValidatorConstraintInterface
|
|
44
|
+
{
|
|
45
|
+
validate(value: unknown, args: ValidationArguments): boolean {
|
|
46
|
+
const obj = args.object as ConversationContactListFilterDto;
|
|
47
|
+
const op = obj?.op;
|
|
48
|
+
if (op === 'in') {
|
|
49
|
+
return Array.isArray(value) && value.length >= 1;
|
|
50
|
+
}
|
|
51
|
+
return !Array.isArray(value);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
defaultMessage(): string {
|
|
55
|
+
return (
|
|
56
|
+
'Para op "in", value deve ser um array não vazio; para as demais operações, value não pode ser array'
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Critério de filtro na listagem de contatos (sessão mais recente por paciente).
|
|
63
|
+
* Apenas `key`, `op` e `value`.
|
|
64
|
+
*/
|
|
65
|
+
export class ConversationContactListFilterDto {
|
|
66
|
+
@ApiProperty({
|
|
67
|
+
description: 'Campo da sessão (camelCase)',
|
|
68
|
+
enum: CONVERSATION_CONTACT_LIST_FILTER_KEYS,
|
|
69
|
+
example: 'patientId',
|
|
70
|
+
})
|
|
71
|
+
@IsString()
|
|
72
|
+
@IsIn(CONVERSATION_CONTACT_LIST_FILTER_KEYS)
|
|
73
|
+
key: ConversationContactListFilterKeyDto;
|
|
74
|
+
|
|
75
|
+
@ApiProperty({
|
|
76
|
+
description: 'Operador de comparação',
|
|
77
|
+
enum: CONVERSATION_CONTACT_LIST_FILTER_OPS,
|
|
78
|
+
example: '==',
|
|
79
|
+
})
|
|
80
|
+
@IsString()
|
|
81
|
+
@IsIn(CONVERSATION_CONTACT_LIST_FILTER_OPS)
|
|
82
|
+
op: ConversationContactListFilterOpDto;
|
|
83
|
+
|
|
84
|
+
@ApiPropertyOptional({
|
|
85
|
+
description:
|
|
86
|
+
'Valor escalar ou, com op "in", array. null permitido para == / != em colunas opcionais (ex.: intention, unitId).',
|
|
87
|
+
example: '00000000-0000-4000-8000-000000000000',
|
|
88
|
+
})
|
|
89
|
+
@Validate(ConversationContactListFilterValueConstraint)
|
|
90
|
+
value: unknown;
|
|
91
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Transform, Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
ArrayMinSize,
|
|
5
|
+
IsArray,
|
|
6
|
+
IsInt,
|
|
7
|
+
IsOptional,
|
|
8
|
+
Max,
|
|
9
|
+
Min,
|
|
10
|
+
ValidateNested,
|
|
11
|
+
} from 'class-validator';
|
|
12
|
+
import { ConversationContactListFilterDto } from './list-conversation-contacts-filters.dto';
|
|
13
|
+
|
|
14
|
+
function parseFiltersFromQuery(
|
|
15
|
+
value: unknown,
|
|
16
|
+
): ConversationContactListFilterDto[] | undefined {
|
|
17
|
+
if (value === undefined || value === null || value === '') {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
return value as ConversationContactListFilterDto[];
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === 'string') {
|
|
24
|
+
try {
|
|
25
|
+
const parsed = JSON.parse(value) as unknown;
|
|
26
|
+
if (!Array.isArray(parsed)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return parsed as ConversationContactListFilterDto[];
|
|
30
|
+
} catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class ListConversationContactsQueryDto {
|
|
38
|
+
@ApiPropertyOptional({
|
|
39
|
+
description: 'Número da página (iniciando em 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: 'Registros por página',
|
|
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
|
+
|
|
62
|
+
@ApiPropertyOptional({
|
|
63
|
+
description:
|
|
64
|
+
'Lista `{ key, op, value }`. Na query HTTP: string JSON (ex.: `[{"key":"conversationType","op":"==","value":"ia"}]`). Ops: ==, !=, >, <, >=, <=, in.',
|
|
65
|
+
type: [ConversationContactListFilterDto],
|
|
66
|
+
isArray: true,
|
|
67
|
+
})
|
|
68
|
+
@IsOptional()
|
|
69
|
+
@Transform(({ value }) => parseFiltersFromQuery(value))
|
|
70
|
+
@IsArray()
|
|
71
|
+
@ArrayMinSize(0)
|
|
72
|
+
@ValidateNested({ each: true })
|
|
73
|
+
@Type(() => ConversationContactListFilterDto)
|
|
74
|
+
filters?: ConversationContactListFilterDto[];
|
|
75
|
+
}
|