tychat-contracts 1.0.101 → 1.0.103
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/conversations/list-conversation-contacts-query.dto.d.ts.map +1 -1
- package/dist/conversations/list-conversation-contacts-query.dto.js +5 -25
- package/dist/notifications/index.d.ts +2 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +5 -1
- package/dist/notifications/notification-list-item.dto.d.ts +2 -0
- package/dist/notifications/notification-list-item.dto.d.ts.map +1 -1
- package/dist/notifications/notification-list-item.dto.js +17 -0
- package/dist/notifications/notifications-kafka-topics.d.ts +2 -0
- package/dist/notifications/notifications-kafka-topics.d.ts.map +1 -1
- package/dist/notifications/notifications-kafka-topics.js +3 -1
- package/dist/notifications/update-notification-viewed.dto.d.ts +15 -0
- package/dist/notifications/update-notification-viewed.dto.d.ts.map +1 -0
- package/dist/notifications/update-notification-viewed.dto.js +53 -0
- package/dist/patients/list-patients-query.dto.d.ts.map +1 -1
- package/dist/patients/list-patients-query.dto.js +5 -25
- package/dist/utils/parse-filters-from-query.util.d.ts +11 -0
- package/dist/utils/parse-filters-from-query.util.d.ts.map +1 -0
- package/dist/utils/parse-filters-from-query.util.js +64 -0
- package/package.json +1 -1
- package/src/conversations/list-conversation-contacts-query.dto.ts +7 -27
- package/src/notifications/index.ts +5 -0
- package/src/notifications/notification-list-item.dto.ts +13 -0
- package/src/notifications/notifications-kafka-topics.ts +3 -0
- package/src/notifications/update-notification-viewed.dto.ts +37 -0
- package/src/patients/list-patients-query.dto.ts +7 -25
- package/src/utils/parse-filters-from-query.util.ts +69 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-conversation-contacts-query.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-query.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-conversation-contacts-query.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/list-conversation-contacts-query.dto.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAE5F,qBAAa,gCAAgC;IAU3C,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;IAgBf,OAAO,CAAC,EAAE,gCAAgC,EAAE,CAAC;CAC9C"}
|
|
@@ -13,28 +13,8 @@ exports.ListConversationContactsQueryDto = void 0;
|
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_transformer_1 = require("class-transformer");
|
|
15
15
|
const class_validator_1 = require("class-validator");
|
|
16
|
+
const parse_filters_from_query_util_1 = require("../utils/parse-filters-from-query.util");
|
|
16
17
|
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
18
|
class ListConversationContactsQueryDto {
|
|
39
19
|
page;
|
|
40
20
|
limit;
|
|
@@ -69,12 +49,12 @@ __decorate([
|
|
|
69
49
|
], ListConversationContactsQueryDto.prototype, "limit", void 0);
|
|
70
50
|
__decorate([
|
|
71
51
|
(0, swagger_1.ApiPropertyOptional)({
|
|
72
|
-
description: 'Lista `{ key, op, value }
|
|
73
|
-
type:
|
|
74
|
-
|
|
52
|
+
description: 'Lista `{ key, op, value }` em **uma única** query string JSON (recomendado no Swagger). Ex.: `[{"key":"conversationType","op":"==","value":"ia"}]`. Ops: ==, !=, >, <, >=, <=, in.',
|
|
53
|
+
type: String,
|
|
54
|
+
example: '[{"key":"intention","op":"==","value":"greeting"}]',
|
|
75
55
|
}),
|
|
76
56
|
(0, class_validator_1.IsOptional)(),
|
|
77
|
-
(0, class_transformer_1.Transform)(({ value }) =>
|
|
57
|
+
(0, class_transformer_1.Transform)(({ value }) => (0, parse_filters_from_query_util_1.parseFilterObjectsFromQuery)(value)),
|
|
78
58
|
(0, class_validator_1.IsArray)(),
|
|
79
59
|
(0, class_validator_1.ArrayMinSize)(0),
|
|
80
60
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { NotificationUserCreatedEventPayload, NotificationPasswordResetRequestedEventPayload, } from './notifications-kafka.payloads';
|
|
2
|
-
export { TOPIC_NOTIFICATIONS_FIND_ALL, TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN, } from './notifications-kafka-topics';
|
|
2
|
+
export { TOPIC_NOTIFICATIONS_FIND_ALL, TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN, TOPIC_NOTIFICATIONS_UPDATE_VIEWED, } from './notifications-kafka-topics';
|
|
3
3
|
export { RegisterPushTokenDto, NotificationsRegisterPushTokenKafkaDto, } from './register-push-token.dto';
|
|
4
4
|
export { ListNotificationsQueryDto, NOTIFICATION_PROVIDER_FILTERS, NOTIFICATION_STATUS_FILTERS, type NotificationProviderFilterDto, type NotificationStatusFilterDto, } from './list-notifications-query.dto';
|
|
5
5
|
export { NotificationListItemDto } from './notification-list-item.dto';
|
|
6
|
+
export { UpdateNotificationViewedDto, NotificationsUpdateViewedKafkaDto, } from './update-notification-viewed.dto';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAAoB,EACpB,sCAAsC,GACvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotificationListItemDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
3
|
+
exports.NotificationsUpdateViewedKafkaDto = exports.UpdateNotificationViewedDto = exports.NotificationListItemDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
4
4
|
var notifications_kafka_payloads_1 = require("./notifications-kafka.payloads");
|
|
5
5
|
Object.defineProperty(exports, "NotificationUserCreatedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationUserCreatedEventPayload; } });
|
|
6
6
|
Object.defineProperty(exports, "NotificationPasswordResetRequestedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationPasswordResetRequestedEventPayload; } });
|
|
7
7
|
var notifications_kafka_topics_1 = require("./notifications-kafka-topics");
|
|
8
8
|
Object.defineProperty(exports, "TOPIC_NOTIFICATIONS_FIND_ALL", { enumerable: true, get: function () { return notifications_kafka_topics_1.TOPIC_NOTIFICATIONS_FIND_ALL; } });
|
|
9
9
|
Object.defineProperty(exports, "TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN", { enumerable: true, get: function () { return notifications_kafka_topics_1.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN; } });
|
|
10
|
+
Object.defineProperty(exports, "TOPIC_NOTIFICATIONS_UPDATE_VIEWED", { enumerable: true, get: function () { return notifications_kafka_topics_1.TOPIC_NOTIFICATIONS_UPDATE_VIEWED; } });
|
|
10
11
|
var register_push_token_dto_1 = require("./register-push-token.dto");
|
|
11
12
|
Object.defineProperty(exports, "RegisterPushTokenDto", { enumerable: true, get: function () { return register_push_token_dto_1.RegisterPushTokenDto; } });
|
|
12
13
|
Object.defineProperty(exports, "NotificationsRegisterPushTokenKafkaDto", { enumerable: true, get: function () { return register_push_token_dto_1.NotificationsRegisterPushTokenKafkaDto; } });
|
|
@@ -16,3 +17,6 @@ Object.defineProperty(exports, "NOTIFICATION_PROVIDER_FILTERS", { enumerable: tr
|
|
|
16
17
|
Object.defineProperty(exports, "NOTIFICATION_STATUS_FILTERS", { enumerable: true, get: function () { return list_notifications_query_dto_1.NOTIFICATION_STATUS_FILTERS; } });
|
|
17
18
|
var notification_list_item_dto_1 = require("./notification-list-item.dto");
|
|
18
19
|
Object.defineProperty(exports, "NotificationListItemDto", { enumerable: true, get: function () { return notification_list_item_dto_1.NotificationListItemDto; } });
|
|
20
|
+
var update_notification_viewed_dto_1 = require("./update-notification-viewed.dto");
|
|
21
|
+
Object.defineProperty(exports, "UpdateNotificationViewedDto", { enumerable: true, get: function () { return update_notification_viewed_dto_1.UpdateNotificationViewedDto; } });
|
|
22
|
+
Object.defineProperty(exports, "NotificationsUpdateViewedKafkaDto", { enumerable: true, get: function () { return update_notification_viewed_dto_1.NotificationsUpdateViewedKafkaDto; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-list-item.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-list-item.dto.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,qBAAa,uBAAuB;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-list-item.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-list-item.dto.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,qBAAa,uBAAuB;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;IAMlB,MAAM,EAAE,OAAO,CAAC;IAOhB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB"}
|
|
@@ -19,6 +19,8 @@ class NotificationListItemDto {
|
|
|
19
19
|
status;
|
|
20
20
|
createdAt;
|
|
21
21
|
updatedAt;
|
|
22
|
+
viewed;
|
|
23
|
+
viewedAt;
|
|
22
24
|
}
|
|
23
25
|
exports.NotificationListItemDto = NotificationListItemDto;
|
|
24
26
|
__decorate([
|
|
@@ -45,3 +47,18 @@ __decorate([
|
|
|
45
47
|
(0, swagger_1.ApiProperty)({ example: '2026-04-08T12:00:00.000Z' }),
|
|
46
48
|
__metadata("design:type", String)
|
|
47
49
|
], NotificationListItemDto.prototype, "updatedAt", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, swagger_1.ApiProperty)({
|
|
52
|
+
description: 'Indica se foi marcada como visualizada (viewedAt != null)',
|
|
53
|
+
example: false,
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", Boolean)
|
|
56
|
+
], NotificationListItemDto.prototype, "viewed", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({
|
|
59
|
+
description: 'Instante em que foi marcada como visualizada; null se não visualizada',
|
|
60
|
+
nullable: true,
|
|
61
|
+
example: null,
|
|
62
|
+
}),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], NotificationListItemDto.prototype, "viewedAt", void 0);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/** Kafka request–reply: lista notificações persistidas no banco do tenant. */
|
|
2
2
|
export declare const TOPIC_NOTIFICATIONS_FIND_ALL = "notifications.findAll";
|
|
3
3
|
export declare const TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = "notifications.registerPushToken";
|
|
4
|
+
/** Kafka request–reply: atualizar visualização de uma notificação persistida. */
|
|
5
|
+
export declare const TOPIC_NOTIFICATIONS_UPDATE_VIEWED = "notifications.updateViewed";
|
|
4
6
|
//# sourceMappingURL=notifications-kafka-topics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-kafka-topics.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications-kafka-topics.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAEpE,eAAO,MAAM,uCAAuC,oCACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"notifications-kafka-topics.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications-kafka-topics.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAEpE,eAAO,MAAM,uCAAuC,oCACjB,CAAC;AAEpC,iFAAiF;AACjF,eAAO,MAAM,iCAAiC,+BAA+B,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = void 0;
|
|
3
|
+
exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = void 0;
|
|
4
4
|
/** Kafka request–reply: lista notificações persistidas no banco do tenant. */
|
|
5
5
|
exports.TOPIC_NOTIFICATIONS_FIND_ALL = 'notifications.findAll';
|
|
6
6
|
exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = 'notifications.registerPushToken';
|
|
7
|
+
/** Kafka request–reply: atualizar visualização de uma notificação persistida. */
|
|
8
|
+
exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = 'notifications.updateViewed';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Corpo HTTP PUT /notifications/:id — marca se o registo foi visualizado.
|
|
3
|
+
*/
|
|
4
|
+
export declare class UpdateNotificationViewedDto {
|
|
5
|
+
viewed: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Payload Kafka `notifications.updateViewed`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class NotificationsUpdateViewedKafkaDto {
|
|
11
|
+
tenant: string;
|
|
12
|
+
id: string;
|
|
13
|
+
payload: UpdateNotificationViewedDto;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=update-notification-viewed.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-notification-viewed.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/update-notification-viewed.dto.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,qBAAa,2BAA2B;IAMtC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,iCAAiC;IAG5C,MAAM,EAAE,MAAM,CAAC;IAGf,EAAE,EAAE,MAAM,CAAC;IAIX,OAAO,EAAE,2BAA2B,CAAC;CACtC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.NotificationsUpdateViewedKafkaDto = exports.UpdateNotificationViewedDto = 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
|
+
/**
|
|
17
|
+
* Corpo HTTP PUT /notifications/:id — marca se o registo foi visualizado.
|
|
18
|
+
*/
|
|
19
|
+
class UpdateNotificationViewedDto {
|
|
20
|
+
viewed;
|
|
21
|
+
}
|
|
22
|
+
exports.UpdateNotificationViewedDto = UpdateNotificationViewedDto;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({
|
|
25
|
+
description: 'true = visualizada (grava viewedAt); false = não visualizada (limpa viewedAt)',
|
|
26
|
+
example: true,
|
|
27
|
+
}),
|
|
28
|
+
(0, class_validator_1.IsBoolean)(),
|
|
29
|
+
__metadata("design:type", Boolean)
|
|
30
|
+
], UpdateNotificationViewedDto.prototype, "viewed", void 0);
|
|
31
|
+
/**
|
|
32
|
+
* Payload Kafka `notifications.updateViewed`.
|
|
33
|
+
*/
|
|
34
|
+
class NotificationsUpdateViewedKafkaDto {
|
|
35
|
+
tenant;
|
|
36
|
+
id;
|
|
37
|
+
payload;
|
|
38
|
+
}
|
|
39
|
+
exports.NotificationsUpdateViewedKafkaDto = NotificationsUpdateViewedKafkaDto;
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], NotificationsUpdateViewedKafkaDto.prototype, "tenant", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], NotificationsUpdateViewedKafkaDto.prototype, "id", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.ValidateNested)(),
|
|
51
|
+
(0, class_transformer_1.Type)(() => UpdateNotificationViewedDto),
|
|
52
|
+
__metadata("design:type", UpdateNotificationViewedDto)
|
|
53
|
+
], NotificationsUpdateViewedKafkaDto.prototype, "payload", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-patients-query.dto.d.ts","sourceRoot":"","sources":["../../src/patients/list-patients-query.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-patients-query.dto.d.ts","sourceRoot":"","sources":["../../src/patients/list-patients-query.dto.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,qBAAa,oBAAoB;IAU/B,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;IAgBf,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAClC"}
|
|
@@ -13,28 +13,8 @@ exports.ListPatientsQueryDto = void 0;
|
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_transformer_1 = require("class-transformer");
|
|
15
15
|
const class_validator_1 = require("class-validator");
|
|
16
|
+
const parse_filters_from_query_util_1 = require("../utils/parse-filters-from-query.util");
|
|
16
17
|
const list_patients_filters_dto_1 = require("./list-patients-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
18
|
class ListPatientsQueryDto {
|
|
39
19
|
page;
|
|
40
20
|
limit;
|
|
@@ -69,12 +49,12 @@ __decorate([
|
|
|
69
49
|
], ListPatientsQueryDto.prototype, "limit", void 0);
|
|
70
50
|
__decorate([
|
|
71
51
|
(0, swagger_1.ApiPropertyOptional)({
|
|
72
|
-
description: 'Lista de filtros `{ key, op, value }
|
|
73
|
-
type:
|
|
74
|
-
|
|
52
|
+
description: 'Lista de filtros `{ key, op, value }` em **uma única** query string JSON. Ex.: `[{"key":"cpf","op":"==","value":"12225217416"}]`. Operações: ==, !=, >, <, >=, <=, in (value array).',
|
|
53
|
+
type: String,
|
|
54
|
+
example: '[{"key":"cpf","op":"==","value":"12225217416"}]',
|
|
75
55
|
}),
|
|
76
56
|
(0, class_validator_1.IsOptional)(),
|
|
77
|
-
(0, class_transformer_1.Transform)(({ value }) =>
|
|
57
|
+
(0, class_transformer_1.Transform)(({ value }) => (0, parse_filters_from_query_util_1.parseFilterObjectsFromQuery)(value)),
|
|
78
58
|
(0, class_validator_1.IsArray)(),
|
|
79
59
|
(0, class_validator_1.ArrayMinSize)(0),
|
|
80
60
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normaliza o parâmetro de query `filters` para um array de objetos DTO.
|
|
3
|
+
*
|
|
4
|
+
* Aceita:
|
|
5
|
+
* - string JSON: `[{"key":"a","op":"==","value":"x"}]`
|
|
6
|
+
* - array de objetos (já parseado pelo framework)
|
|
7
|
+
* - array com um único string (JSON do array inteiro) — UI Swagger “array” com um item
|
|
8
|
+
* - array de strings, cada uma um JSON de um único objeto filtro
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseFilterObjectsFromQuery<T>(value: unknown): T[] | undefined;
|
|
11
|
+
//# sourceMappingURL=parse-filters-from-query.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-filters-from-query.util.d.ts","sourceRoot":"","sources":["../../src/utils/parse-filters-from-query.util.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,GAAG,SAAS,CA2D9E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFilterObjectsFromQuery = parseFilterObjectsFromQuery;
|
|
4
|
+
/**
|
|
5
|
+
* Normaliza o parâmetro de query `filters` para um array de objetos DTO.
|
|
6
|
+
*
|
|
7
|
+
* Aceita:
|
|
8
|
+
* - string JSON: `[{"key":"a","op":"==","value":"x"}]`
|
|
9
|
+
* - array de objetos (já parseado pelo framework)
|
|
10
|
+
* - array com um único string (JSON do array inteiro) — UI Swagger “array” com um item
|
|
11
|
+
* - array de strings, cada uma um JSON de um único objeto filtro
|
|
12
|
+
*/
|
|
13
|
+
function parseFilterObjectsFromQuery(value) {
|
|
14
|
+
if (value === undefined || value === null || value === '') {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const asObjectArray = (arr) => {
|
|
18
|
+
if (!Array.isArray(arr))
|
|
19
|
+
return undefined;
|
|
20
|
+
if (arr.length === 0)
|
|
21
|
+
return [];
|
|
22
|
+
if (arr.every((item) => item !== null && typeof item === 'object' && !Array.isArray(item))) {
|
|
23
|
+
return arr;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
};
|
|
27
|
+
if (typeof value === 'string') {
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(value);
|
|
30
|
+
return asObjectArray(parsed);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
const direct = asObjectArray(value);
|
|
38
|
+
if (direct)
|
|
39
|
+
return direct;
|
|
40
|
+
if (value.length === 1 && typeof value[0] === 'string') {
|
|
41
|
+
return parseFilterObjectsFromQuery(value[0]);
|
|
42
|
+
}
|
|
43
|
+
if (value.length > 0 && value.every((v) => typeof v === 'string')) {
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const s of value) {
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(s);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (parsed === null ||
|
|
54
|
+
typeof parsed !== 'object' ||
|
|
55
|
+
Array.isArray(parsed)) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
out.push(parsed);
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -9,31 +9,9 @@ import {
|
|
|
9
9
|
Min,
|
|
10
10
|
ValidateNested,
|
|
11
11
|
} from 'class-validator';
|
|
12
|
+
import { parseFilterObjectsFromQuery } from '../utils/parse-filters-from-query.util';
|
|
12
13
|
import { ConversationContactListFilterDto } from './list-conversation-contacts-filters.dto';
|
|
13
14
|
|
|
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
15
|
export class ListConversationContactsQueryDto {
|
|
38
16
|
@ApiPropertyOptional({
|
|
39
17
|
description: 'Número da página (iniciando em 1)',
|
|
@@ -61,12 +39,14 @@ export class ListConversationContactsQueryDto {
|
|
|
61
39
|
|
|
62
40
|
@ApiPropertyOptional({
|
|
63
41
|
description:
|
|
64
|
-
'Lista `{ key, op, value }
|
|
65
|
-
type:
|
|
66
|
-
|
|
42
|
+
'Lista `{ key, op, value }` em **uma única** query string JSON (recomendado no Swagger). Ex.: `[{"key":"conversationType","op":"==","value":"ia"}]`. Ops: ==, !=, >, <, >=, <=, in.',
|
|
43
|
+
type: String,
|
|
44
|
+
example: '[{"key":"intention","op":"==","value":"greeting"}]',
|
|
67
45
|
})
|
|
68
46
|
@IsOptional()
|
|
69
|
-
@Transform(({ value }) =>
|
|
47
|
+
@Transform(({ value }) =>
|
|
48
|
+
parseFilterObjectsFromQuery<ConversationContactListFilterDto>(value),
|
|
49
|
+
)
|
|
70
50
|
@IsArray()
|
|
71
51
|
@ArrayMinSize(0)
|
|
72
52
|
@ValidateNested({ each: true })
|
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
export {
|
|
6
6
|
TOPIC_NOTIFICATIONS_FIND_ALL,
|
|
7
7
|
TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN,
|
|
8
|
+
TOPIC_NOTIFICATIONS_UPDATE_VIEWED,
|
|
8
9
|
} from './notifications-kafka-topics';
|
|
9
10
|
export {
|
|
10
11
|
RegisterPushTokenDto,
|
|
@@ -18,3 +19,7 @@ export {
|
|
|
18
19
|
type NotificationStatusFilterDto,
|
|
19
20
|
} from './list-notifications-query.dto';
|
|
20
21
|
export { NotificationListItemDto } from './notification-list-item.dto';
|
|
22
|
+
export {
|
|
23
|
+
UpdateNotificationViewedDto,
|
|
24
|
+
NotificationsUpdateViewedKafkaDto,
|
|
25
|
+
} from './update-notification-viewed.dto';
|
|
@@ -19,4 +19,17 @@ export class NotificationListItemDto {
|
|
|
19
19
|
|
|
20
20
|
@ApiProperty({ example: '2026-04-08T12:00:00.000Z' })
|
|
21
21
|
updatedAt: string;
|
|
22
|
+
|
|
23
|
+
@ApiProperty({
|
|
24
|
+
description: 'Indica se foi marcada como visualizada (viewedAt != null)',
|
|
25
|
+
example: false,
|
|
26
|
+
})
|
|
27
|
+
viewed: boolean;
|
|
28
|
+
|
|
29
|
+
@ApiProperty({
|
|
30
|
+
description: 'Instante em que foi marcada como visualizada; null se não visualizada',
|
|
31
|
+
nullable: true,
|
|
32
|
+
example: null,
|
|
33
|
+
})
|
|
34
|
+
viewedAt: string | null;
|
|
22
35
|
}
|
|
@@ -3,3 +3,6 @@ export const TOPIC_NOTIFICATIONS_FIND_ALL = 'notifications.findAll';
|
|
|
3
3
|
|
|
4
4
|
export const TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN =
|
|
5
5
|
'notifications.registerPushToken';
|
|
6
|
+
|
|
7
|
+
/** Kafka request–reply: atualizar visualização de uma notificação persistida. */
|
|
8
|
+
export const TOPIC_NOTIFICATIONS_UPDATE_VIEWED = 'notifications.updateViewed';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
IsBoolean,
|
|
5
|
+
IsNotEmpty,
|
|
6
|
+
IsString,
|
|
7
|
+
IsUUID,
|
|
8
|
+
ValidateNested,
|
|
9
|
+
} from 'class-validator';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Corpo HTTP PUT /notifications/:id — marca se o registo foi visualizado.
|
|
13
|
+
*/
|
|
14
|
+
export class UpdateNotificationViewedDto {
|
|
15
|
+
@ApiProperty({
|
|
16
|
+
description: 'true = visualizada (grava viewedAt); false = não visualizada (limpa viewedAt)',
|
|
17
|
+
example: true,
|
|
18
|
+
})
|
|
19
|
+
@IsBoolean()
|
|
20
|
+
viewed: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Payload Kafka `notifications.updateViewed`.
|
|
25
|
+
*/
|
|
26
|
+
export class NotificationsUpdateViewedKafkaDto {
|
|
27
|
+
@IsString()
|
|
28
|
+
@IsNotEmpty()
|
|
29
|
+
tenant: string;
|
|
30
|
+
|
|
31
|
+
@IsUUID('4')
|
|
32
|
+
id: string;
|
|
33
|
+
|
|
34
|
+
@ValidateNested()
|
|
35
|
+
@Type(() => UpdateNotificationViewedDto)
|
|
36
|
+
payload: UpdateNotificationViewedDto;
|
|
37
|
+
}
|
|
@@ -9,29 +9,9 @@ import {
|
|
|
9
9
|
Min,
|
|
10
10
|
ValidateNested,
|
|
11
11
|
} from 'class-validator';
|
|
12
|
+
import { parseFilterObjectsFromQuery } from '../utils/parse-filters-from-query.util';
|
|
12
13
|
import { PatientListFilterDto } from './list-patients-filters.dto';
|
|
13
14
|
|
|
14
|
-
function parseFiltersFromQuery(value: unknown): PatientListFilterDto[] | undefined {
|
|
15
|
-
if (value === undefined || value === null || value === '') {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
if (Array.isArray(value)) {
|
|
19
|
-
return value as PatientListFilterDto[];
|
|
20
|
-
}
|
|
21
|
-
if (typeof value === 'string') {
|
|
22
|
-
try {
|
|
23
|
-
const parsed = JSON.parse(value) as unknown;
|
|
24
|
-
if (!Array.isArray(parsed)) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
return parsed as PatientListFilterDto[];
|
|
28
|
-
} catch {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
15
|
export class ListPatientsQueryDto {
|
|
36
16
|
@ApiPropertyOptional({
|
|
37
17
|
description: 'Número da página (iniciando em 1)',
|
|
@@ -59,12 +39,14 @@ export class ListPatientsQueryDto {
|
|
|
59
39
|
|
|
60
40
|
@ApiPropertyOptional({
|
|
61
41
|
description:
|
|
62
|
-
'Lista de filtros `{ key, op, value }
|
|
63
|
-
type:
|
|
64
|
-
|
|
42
|
+
'Lista de filtros `{ key, op, value }` em **uma única** query string JSON. Ex.: `[{"key":"cpf","op":"==","value":"12225217416"}]`. Operações: ==, !=, >, <, >=, <=, in (value array).',
|
|
43
|
+
type: String,
|
|
44
|
+
example: '[{"key":"cpf","op":"==","value":"12225217416"}]',
|
|
65
45
|
})
|
|
66
46
|
@IsOptional()
|
|
67
|
-
@Transform(({ value }) =>
|
|
47
|
+
@Transform(({ value }) =>
|
|
48
|
+
parseFilterObjectsFromQuery<PatientListFilterDto>(value),
|
|
49
|
+
)
|
|
68
50
|
@IsArray()
|
|
69
51
|
@ArrayMinSize(0)
|
|
70
52
|
@ValidateNested({ each: true })
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normaliza o parâmetro de query `filters` para um array de objetos DTO.
|
|
3
|
+
*
|
|
4
|
+
* Aceita:
|
|
5
|
+
* - string JSON: `[{"key":"a","op":"==","value":"x"}]`
|
|
6
|
+
* - array de objetos (já parseado pelo framework)
|
|
7
|
+
* - array com um único string (JSON do array inteiro) — UI Swagger “array” com um item
|
|
8
|
+
* - array de strings, cada uma um JSON de um único objeto filtro
|
|
9
|
+
*/
|
|
10
|
+
export function parseFilterObjectsFromQuery<T>(value: unknown): T[] | undefined {
|
|
11
|
+
if (value === undefined || value === null || value === '') {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const asObjectArray = (arr: unknown): T[] | undefined => {
|
|
16
|
+
if (!Array.isArray(arr)) return undefined;
|
|
17
|
+
if (arr.length === 0) return [];
|
|
18
|
+
if (
|
|
19
|
+
arr.every(
|
|
20
|
+
(item) =>
|
|
21
|
+
item !== null && typeof item === 'object' && !Array.isArray(item),
|
|
22
|
+
)
|
|
23
|
+
) {
|
|
24
|
+
return arr as T[];
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (typeof value === 'string') {
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(value) as unknown;
|
|
32
|
+
return asObjectArray(parsed);
|
|
33
|
+
} catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (Array.isArray(value)) {
|
|
39
|
+
const direct = asObjectArray(value);
|
|
40
|
+
if (direct) return direct;
|
|
41
|
+
|
|
42
|
+
if (value.length === 1 && typeof value[0] === 'string') {
|
|
43
|
+
return parseFilterObjectsFromQuery<T>(value[0]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (value.length > 0 && value.every((v) => typeof v === 'string')) {
|
|
47
|
+
const out: T[] = [];
|
|
48
|
+
for (const s of value) {
|
|
49
|
+
let parsed: unknown;
|
|
50
|
+
try {
|
|
51
|
+
parsed = JSON.parse(s);
|
|
52
|
+
} catch {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
if (
|
|
56
|
+
parsed === null ||
|
|
57
|
+
typeof parsed !== 'object' ||
|
|
58
|
+
Array.isArray(parsed)
|
|
59
|
+
) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
out.push(parsed as T);
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|