tychat-contracts 1.0.74 → 1.0.75

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.
@@ -6,7 +6,6 @@
6
6
  */
7
7
  export declare class FollowupConfigResponseDto {
8
8
  id: string;
9
- tenant: string;
10
9
  unitId?: number;
11
10
  abandonmentThresholdMinutes: number;
12
11
  followup1DelayMinutes: number;
@@ -1 +1 @@
1
- {"version":3,"file":"followup-config-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-config-response.dto.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,yBAAyB;IAIpC,EAAE,EAAE,MAAM,CAAC;IAKX,MAAM,EAAE,MAAM,CAAC;IAMf,MAAM,CAAC,EAAE,MAAM,CAAC;IAYhB,2BAA2B,EAAE,MAAM,CAAC;IAKpC,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAS9B,yBAAyB,EAAE,MAAM,CAAC;IAIlC,mBAAmB,EAAE,OAAO,CAAC;IAS7B,+BAA+B,EAAE,MAAM,CAAC;IAIxC,0BAA0B,EAAE,OAAO,CAAC;IAKpC,gCAAgC,EAAE,MAAM,CAAC;IAIzC,2BAA2B,EAAE,OAAO,CAAC;IASrC,kBAAkB,EAAE,MAAM,CAAC;IAI3B,aAAa,EAAE,OAAO,CAAC;IASvB,yBAAyB,EAAE,MAAM,CAAC;IAIlC,oBAAoB,EAAE,OAAO,CAAC;IAS9B,4BAA4B,EAAE,MAAM,CAAC;IAIrC,uBAAuB,EAAE,OAAO,CAAC;IAQjC,OAAO,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"followup-config-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-config-response.dto.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,yBAAyB;IAIpC,EAAE,EAAE,MAAM,CAAC;IAMX,MAAM,CAAC,EAAE,MAAM,CAAC;IAYhB,2BAA2B,EAAE,MAAM,CAAC;IAKpC,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAS9B,yBAAyB,EAAE,MAAM,CAAC;IAIlC,mBAAmB,EAAE,OAAO,CAAC;IAS7B,+BAA+B,EAAE,MAAM,CAAC;IAIxC,0BAA0B,EAAE,OAAO,CAAC;IAKpC,gCAAgC,EAAE,MAAM,CAAC;IAIzC,2BAA2B,EAAE,OAAO,CAAC;IASrC,kBAAkB,EAAE,MAAM,CAAC;IAI3B,aAAa,EAAE,OAAO,CAAC;IASvB,yBAAyB,EAAE,MAAM,CAAC;IAIlC,oBAAoB,EAAE,OAAO,CAAC;IAS9B,4BAA4B,EAAE,MAAM,CAAC;IAIrC,uBAAuB,EAAE,OAAO,CAAC;IAQjC,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -20,7 +20,6 @@ const class_validator_1 = require("class-validator");
20
20
  */
21
21
  class FollowupConfigResponseDto {
22
22
  id;
23
- tenant;
24
23
  unitId;
25
24
  // ---------------------------------------------------------------------------
26
25
  // Abandonment follow-up settings
@@ -70,12 +69,6 @@ __decorate([
70
69
  (0, class_validator_1.IsNotEmpty)(),
71
70
  __metadata("design:type", String)
72
71
  ], FollowupConfigResponseDto.prototype, "id", void 0);
73
- __decorate([
74
- (0, swagger_1.ApiProperty)({ description: 'Tenant slug', example: 'clinic-alpha' }),
75
- (0, class_validator_1.IsString)(),
76
- (0, class_validator_1.IsNotEmpty)(),
77
- __metadata("design:type", String)
78
- ], FollowupConfigResponseDto.prototype, "tenant", void 0);
79
72
  __decorate([
80
73
  (0, swagger_1.ApiPropertyOptional)({ description: 'Tenant unit id', example: 1 }),
81
74
  (0, class_validator_1.IsOptional)(),
@@ -0,0 +1,30 @@
1
+ export declare const TOPIC_MESSAGE_SENT = "MESSAGE_SENT";
2
+ export declare const TOPIC_MESSAGE_RECEIVED = "MESSAGE_RECEIVED";
3
+ export declare const TOPIC_FOLLOWUP_CONFIG_UPDATED = "FOLLOWUP_CONFIG_UPDATED";
4
+ export declare const TOPIC_APPOINTMENT_CHANGED = "APPOINTMENT_CHANGED";
5
+ export declare class FollowupConversationEventPayload {
6
+ tenant: string;
7
+ patientId: string;
8
+ sessionUuid: string;
9
+ unitId?: number;
10
+ messageType: 'ia' | 'human' | 'patient';
11
+ isFollowup?: boolean;
12
+ occurredAt: string;
13
+ }
14
+ export declare class FollowupConfigUpdatedEventPayload {
15
+ tenant: string;
16
+ unitId?: number;
17
+ config: Record<string, unknown>;
18
+ occurredAt: string;
19
+ }
20
+ export declare class AppointmentChangedEventPayload {
21
+ tenant: string;
22
+ appointmentId: string;
23
+ patientId: string;
24
+ status: string;
25
+ previousStatus?: string;
26
+ date?: string;
27
+ exitTime?: string;
28
+ occurredAt: string;
29
+ }
30
+ //# sourceMappingURL=followup-events.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"followup-events.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-events.dto.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AACvE,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D,qBAAa,gCAAgC;IAK3C,MAAM,EAAE,MAAM,CAAC;IAMf,SAAS,EAAE,MAAM,CAAC;IAIlB,WAAW,EAAE,MAAM,CAAC;IAIpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,WAAW,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,CAAC;IAKxC,UAAU,CAAC,EAAE,OAAO,CAAC;IAIrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,iCAAiC;IAK5C,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIhC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,8BAA8B;IAKzC,MAAM,EAAE,MAAM,CAAC;IAIf,aAAa,EAAE,MAAM,CAAC;IAMtB,SAAS,EAAE,MAAM,CAAC;IAMlB,MAAM,EAAE,MAAM,CAAC;IAMf,cAAc,CAAC,EAAE,MAAM,CAAC;IAKxB,IAAI,CAAC,EAAE,MAAM,CAAC;IAKd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,162 @@
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.AppointmentChangedEventPayload = exports.FollowupConfigUpdatedEventPayload = exports.FollowupConversationEventPayload = exports.TOPIC_APPOINTMENT_CHANGED = exports.TOPIC_FOLLOWUP_CONFIG_UPDATED = exports.TOPIC_MESSAGE_RECEIVED = exports.TOPIC_MESSAGE_SENT = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ exports.TOPIC_MESSAGE_SENT = 'MESSAGE_SENT';
16
+ exports.TOPIC_MESSAGE_RECEIVED = 'MESSAGE_RECEIVED';
17
+ exports.TOPIC_FOLLOWUP_CONFIG_UPDATED = 'FOLLOWUP_CONFIG_UPDATED';
18
+ exports.TOPIC_APPOINTMENT_CHANGED = 'APPOINTMENT_CHANGED';
19
+ class FollowupConversationEventPayload {
20
+ tenant;
21
+ patientId;
22
+ sessionUuid;
23
+ unitId;
24
+ messageType;
25
+ isFollowup;
26
+ occurredAt;
27
+ }
28
+ exports.FollowupConversationEventPayload = FollowupConversationEventPayload;
29
+ __decorate([
30
+ (0, swagger_1.ApiProperty)({ example: 'homolog' }),
31
+ (0, class_validator_1.IsString)(),
32
+ (0, class_validator_1.MinLength)(1),
33
+ (0, class_validator_1.MaxLength)(255),
34
+ __metadata("design:type", String)
35
+ ], FollowupConversationEventPayload.prototype, "tenant", void 0);
36
+ __decorate([
37
+ (0, swagger_1.ApiProperty)({ example: '3c593727-4505-495a-a054-c052acb4cf19' }),
38
+ (0, class_validator_1.IsString)(),
39
+ (0, class_validator_1.MinLength)(1),
40
+ (0, class_validator_1.MaxLength)(255),
41
+ __metadata("design:type", String)
42
+ ], FollowupConversationEventPayload.prototype, "patientId", void 0);
43
+ __decorate([
44
+ (0, swagger_1.ApiProperty)({ example: 'f3f50ecb-fb71-4d4b-a0dd-910ef6e3fd0a' }),
45
+ (0, class_validator_1.IsUUID)(),
46
+ __metadata("design:type", String)
47
+ ], FollowupConversationEventPayload.prototype, "sessionUuid", void 0);
48
+ __decorate([
49
+ (0, swagger_1.ApiProperty)({ required: false, example: 1 }),
50
+ (0, class_validator_1.IsOptional)(),
51
+ __metadata("design:type", Number)
52
+ ], FollowupConversationEventPayload.prototype, "unitId", void 0);
53
+ __decorate([
54
+ (0, swagger_1.ApiProperty)({ example: 'ia' }),
55
+ (0, class_validator_1.IsString)(),
56
+ (0, class_validator_1.MinLength)(1),
57
+ (0, class_validator_1.MaxLength)(50),
58
+ __metadata("design:type", String)
59
+ ], FollowupConversationEventPayload.prototype, "messageType", void 0);
60
+ __decorate([
61
+ (0, swagger_1.ApiProperty)({ required: false, example: false }),
62
+ (0, class_validator_1.IsOptional)(),
63
+ (0, class_validator_1.IsBoolean)(),
64
+ __metadata("design:type", Boolean)
65
+ ], FollowupConversationEventPayload.prototype, "isFollowup", void 0);
66
+ __decorate([
67
+ (0, swagger_1.ApiProperty)({ example: '2026-03-30T12:03:14.000Z' }),
68
+ (0, class_validator_1.IsISO8601)(),
69
+ __metadata("design:type", String)
70
+ ], FollowupConversationEventPayload.prototype, "occurredAt", void 0);
71
+ class FollowupConfigUpdatedEventPayload {
72
+ tenant;
73
+ unitId;
74
+ config;
75
+ occurredAt;
76
+ }
77
+ exports.FollowupConfigUpdatedEventPayload = FollowupConfigUpdatedEventPayload;
78
+ __decorate([
79
+ (0, swagger_1.ApiProperty)({ example: 'homolog' }),
80
+ (0, class_validator_1.IsString)(),
81
+ (0, class_validator_1.MinLength)(1),
82
+ (0, class_validator_1.MaxLength)(255),
83
+ __metadata("design:type", String)
84
+ ], FollowupConfigUpdatedEventPayload.prototype, "tenant", void 0);
85
+ __decorate([
86
+ (0, swagger_1.ApiProperty)({ required: false, example: 1 }),
87
+ (0, class_validator_1.IsOptional)(),
88
+ __metadata("design:type", Number)
89
+ ], FollowupConfigUpdatedEventPayload.prototype, "unitId", void 0);
90
+ __decorate([
91
+ (0, swagger_1.ApiProperty)({
92
+ description: 'Serialized follow-up configuration snapshot stored in cache.',
93
+ type: Object,
94
+ }),
95
+ __metadata("design:type", Object)
96
+ ], FollowupConfigUpdatedEventPayload.prototype, "config", void 0);
97
+ __decorate([
98
+ (0, swagger_1.ApiProperty)({ example: '2026-03-30T12:03:14.000Z' }),
99
+ (0, class_validator_1.IsISO8601)(),
100
+ __metadata("design:type", String)
101
+ ], FollowupConfigUpdatedEventPayload.prototype, "occurredAt", void 0);
102
+ class AppointmentChangedEventPayload {
103
+ tenant;
104
+ appointmentId;
105
+ patientId;
106
+ status;
107
+ previousStatus;
108
+ date;
109
+ exitTime;
110
+ occurredAt;
111
+ }
112
+ exports.AppointmentChangedEventPayload = AppointmentChangedEventPayload;
113
+ __decorate([
114
+ (0, swagger_1.ApiProperty)({ example: 'homolog' }),
115
+ (0, class_validator_1.IsString)(),
116
+ (0, class_validator_1.MinLength)(1),
117
+ (0, class_validator_1.MaxLength)(255),
118
+ __metadata("design:type", String)
119
+ ], AppointmentChangedEventPayload.prototype, "tenant", void 0);
120
+ __decorate([
121
+ (0, swagger_1.ApiProperty)({ example: 'f3f50ecb-fb71-4d4b-a0dd-910ef6e3fd0a' }),
122
+ (0, class_validator_1.IsUUID)(),
123
+ __metadata("design:type", String)
124
+ ], AppointmentChangedEventPayload.prototype, "appointmentId", void 0);
125
+ __decorate([
126
+ (0, swagger_1.ApiProperty)({ example: '3c593727-4505-495a-a054-c052acb4cf19' }),
127
+ (0, class_validator_1.IsString)(),
128
+ (0, class_validator_1.MinLength)(1),
129
+ (0, class_validator_1.MaxLength)(255),
130
+ __metadata("design:type", String)
131
+ ], AppointmentChangedEventPayload.prototype, "patientId", void 0);
132
+ __decorate([
133
+ (0, swagger_1.ApiProperty)({ example: 'sended' }),
134
+ (0, class_validator_1.IsString)(),
135
+ (0, class_validator_1.MinLength)(1),
136
+ (0, class_validator_1.MaxLength)(50),
137
+ __metadata("design:type", String)
138
+ ], AppointmentChangedEventPayload.prototype, "status", void 0);
139
+ __decorate([
140
+ (0, swagger_1.ApiProperty)({ required: false, example: 'pending' }),
141
+ (0, class_validator_1.IsOptional)(),
142
+ (0, class_validator_1.IsString)(),
143
+ (0, class_validator_1.MaxLength)(50),
144
+ __metadata("design:type", String)
145
+ ], AppointmentChangedEventPayload.prototype, "previousStatus", void 0);
146
+ __decorate([
147
+ (0, swagger_1.ApiProperty)({ required: false, example: '2026-03-30T15:00:00.000Z' }),
148
+ (0, class_validator_1.IsOptional)(),
149
+ (0, class_validator_1.IsISO8601)(),
150
+ __metadata("design:type", String)
151
+ ], AppointmentChangedEventPayload.prototype, "date", void 0);
152
+ __decorate([
153
+ (0, swagger_1.ApiProperty)({ required: false, example: '2026-03-30T16:00:00.000Z' }),
154
+ (0, class_validator_1.IsOptional)(),
155
+ (0, class_validator_1.IsISO8601)(),
156
+ __metadata("design:type", String)
157
+ ], AppointmentChangedEventPayload.prototype, "exitTime", void 0);
158
+ __decorate([
159
+ (0, swagger_1.ApiProperty)({ example: '2026-03-30T12:03:14.000Z' }),
160
+ (0, class_validator_1.IsISO8601)(),
161
+ __metadata("design:type", String)
162
+ ], AppointmentChangedEventPayload.prototype, "occurredAt", void 0);
@@ -5,7 +5,6 @@ import { FollowupTypeDto } from './followup-type.dto';
5
5
  */
6
6
  export declare class FollowupLogResponseDto {
7
7
  id: string;
8
- tenant: string;
9
8
  sessionUuid?: string | null;
10
9
  patientId: string;
11
10
  attempt: number;
@@ -1 +1 @@
1
- {"version":3,"file":"followup-log-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-log-response.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;GAGG;AACH,qBAAa,sBAAsB;IAIjC,EAAE,EAAE,MAAM,CAAC;IAKX,MAAM,EAAE,MAAM,CAAC;IAKf,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAK5B,SAAS,EAAE,MAAM,CAAC;IAMlB,OAAO,EAAE,MAAM,CAAC;IAKhB,OAAO,EAAE,MAAM,CAAC;IAKhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAQnB,YAAY,EAAE,eAAe,CAAC;IAK9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAK9B,MAAM,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"followup-log-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-log-response.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;GAGG;AACH,qBAAa,sBAAsB;IAIjC,EAAE,EAAE,MAAM,CAAC;IAKX,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAK5B,SAAS,EAAE,MAAM,CAAC;IAMlB,OAAO,EAAE,MAAM,CAAC;IAKhB,OAAO,EAAE,MAAM,CAAC;IAKhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAQnB,YAAY,EAAE,eAAe,CAAC;IAK9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAK9B,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -19,7 +19,6 @@ const followup_type_dto_1 = require("./followup-type.dto");
19
19
  */
20
20
  class FollowupLogResponseDto {
21
21
  id;
22
- tenant;
23
22
  sessionUuid;
24
23
  patientId;
25
24
  attempt;
@@ -36,12 +35,6 @@ __decorate([
36
35
  (0, class_validator_1.IsNotEmpty)(),
37
36
  __metadata("design:type", String)
38
37
  ], FollowupLogResponseDto.prototype, "id", void 0);
39
- __decorate([
40
- (0, swagger_1.ApiProperty)({ description: 'Tenant slug', example: 'clinic-alpha' }),
41
- (0, class_validator_1.IsString)(),
42
- (0, class_validator_1.IsNotEmpty)(),
43
- __metadata("design:type", String)
44
- ], FollowupLogResponseDto.prototype, "tenant", void 0);
45
38
  __decorate([
46
39
  (0, swagger_1.ApiPropertyOptional)({ description: 'Session UUID from conversation_sessions (null for appointment-based)' }),
47
40
  (0, class_validator_1.IsOptional)(),
@@ -7,4 +7,6 @@ export * from './conversation-response.dto';
7
7
  export * from './followup-type.dto';
8
8
  export * from './followup-config-response.dto';
9
9
  export * from './followup-log-response.dto';
10
+ export * from './satisfaction-response.dto';
11
+ export * from './followup-events.dto';
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -23,3 +23,5 @@ __exportStar(require("./conversation-response.dto"), exports);
23
23
  __exportStar(require("./followup-type.dto"), exports);
24
24
  __exportStar(require("./followup-config-response.dto"), exports);
25
25
  __exportStar(require("./followup-log-response.dto"), exports);
26
+ __exportStar(require("./satisfaction-response.dto"), exports);
27
+ __exportStar(require("./followup-events.dto"), exports);
@@ -0,0 +1,36 @@
1
+ /** Valid satisfaction survey types. */
2
+ export declare const SATISFACTION_TYPES: readonly ["satisfaction_booking", "satisfaction_finished"];
3
+ export type SatisfactionTypeDto = (typeof SATISFACTION_TYPES)[number];
4
+ /**
5
+ * Payload to save a patient's satisfaction rating.
6
+ * Sent from the conversation-service to the followup-service
7
+ * when the AI detects a numeric satisfaction response.
8
+ */
9
+ export declare class SaveSatisfactionRequestDto {
10
+ tenant: string;
11
+ patientId: string;
12
+ appointmentId: string;
13
+ satisfactionType: SatisfactionTypeDto;
14
+ rating: number;
15
+ comment?: string;
16
+ }
17
+ /**
18
+ * Response DTO for a saved satisfaction rating.
19
+ */
20
+ export declare class SatisfactionResponseDto {
21
+ id: string;
22
+ patientId: string;
23
+ appointmentId: string;
24
+ satisfactionType: SatisfactionTypeDto;
25
+ rating: number;
26
+ comment?: string | null;
27
+ createdAt: string;
28
+ }
29
+ /**
30
+ * Response DTO for average satisfaction stats.
31
+ */
32
+ export declare class SatisfactionAverageDto {
33
+ average: number;
34
+ count: number;
35
+ }
36
+ //# sourceMappingURL=satisfaction-response.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"satisfaction-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/satisfaction-response.dto.ts"],"names":[],"mappings":"AAYA,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,4DAGrB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,0BAA0B;IAIrC,MAAM,EAAE,MAAM,CAAC;IAKf,SAAS,EAAE,MAAM,CAAC;IAKlB,aAAa,EAAE,MAAM,CAAC;IAQtB,gBAAgB,EAAE,mBAAmB,CAAC;IAMtC,MAAM,EAAE,MAAM,CAAC;IAMf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAIlC,EAAE,EAAE,MAAM,CAAC;IAKX,SAAS,EAAE,MAAM,CAAC;IAKlB,aAAa,EAAE,MAAM,CAAC;IAQtB,gBAAgB,EAAE,mBAAmB,CAAC;IAMtC,MAAM,EAAE,MAAM,CAAC;IAKf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAKxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAEjC,OAAO,EAAE,MAAM,CAAC;IAGhB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,149 @@
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.SatisfactionAverageDto = exports.SatisfactionResponseDto = exports.SaveSatisfactionRequestDto = exports.SATISFACTION_TYPES = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ /** Valid satisfaction survey types. */
16
+ exports.SATISFACTION_TYPES = [
17
+ 'satisfaction_booking',
18
+ 'satisfaction_finished',
19
+ ];
20
+ /**
21
+ * Payload to save a patient's satisfaction rating.
22
+ * Sent from the conversation-service to the followup-service
23
+ * when the AI detects a numeric satisfaction response.
24
+ */
25
+ class SaveSatisfactionRequestDto {
26
+ tenant;
27
+ patientId;
28
+ appointmentId;
29
+ satisfactionType;
30
+ rating;
31
+ comment;
32
+ }
33
+ exports.SaveSatisfactionRequestDto = SaveSatisfactionRequestDto;
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({ description: 'Tenant slug', example: 'clinic-alpha' }),
36
+ (0, class_validator_1.IsString)(),
37
+ (0, class_validator_1.IsNotEmpty)(),
38
+ __metadata("design:type", String)
39
+ ], SaveSatisfactionRequestDto.prototype, "tenant", void 0);
40
+ __decorate([
41
+ (0, swagger_1.ApiProperty)({ description: 'Patient UUID' }),
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsNotEmpty)(),
44
+ __metadata("design:type", String)
45
+ ], SaveSatisfactionRequestDto.prototype, "patientId", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiProperty)({ description: 'Appointment UUID linked to the satisfaction survey' }),
48
+ (0, class_validator_1.IsString)(),
49
+ (0, class_validator_1.IsNotEmpty)(),
50
+ __metadata("design:type", String)
51
+ ], SaveSatisfactionRequestDto.prototype, "appointmentId", void 0);
52
+ __decorate([
53
+ (0, swagger_1.ApiProperty)({
54
+ description: 'Type of satisfaction survey',
55
+ enum: exports.SATISFACTION_TYPES,
56
+ example: 'satisfaction_booking',
57
+ }),
58
+ (0, class_validator_1.IsIn)(exports.SATISFACTION_TYPES),
59
+ __metadata("design:type", String)
60
+ ], SaveSatisfactionRequestDto.prototype, "satisfactionType", void 0);
61
+ __decorate([
62
+ (0, swagger_1.ApiProperty)({ description: 'Patient satisfaction rating (1-5)', example: 4 }),
63
+ (0, class_validator_1.IsInt)(),
64
+ (0, class_validator_1.Min)(1),
65
+ (0, class_validator_1.Max)(5),
66
+ __metadata("design:type", Number)
67
+ ], SaveSatisfactionRequestDto.prototype, "rating", void 0);
68
+ __decorate([
69
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Optional text comment from the patient', example: 'Otimo atendimento!' }),
70
+ (0, class_validator_1.IsOptional)(),
71
+ (0, class_validator_1.IsString)(),
72
+ (0, class_validator_1.MaxLength)(2000),
73
+ __metadata("design:type", String)
74
+ ], SaveSatisfactionRequestDto.prototype, "comment", void 0);
75
+ /**
76
+ * Response DTO for a saved satisfaction rating.
77
+ */
78
+ class SatisfactionResponseDto {
79
+ id;
80
+ patientId;
81
+ appointmentId;
82
+ satisfactionType;
83
+ rating;
84
+ comment;
85
+ createdAt;
86
+ }
87
+ exports.SatisfactionResponseDto = SatisfactionResponseDto;
88
+ __decorate([
89
+ (0, swagger_1.ApiProperty)({ description: 'Primary key (UUID)' }),
90
+ (0, class_validator_1.IsString)(),
91
+ (0, class_validator_1.IsNotEmpty)(),
92
+ __metadata("design:type", String)
93
+ ], SatisfactionResponseDto.prototype, "id", void 0);
94
+ __decorate([
95
+ (0, swagger_1.ApiProperty)({ description: 'Patient UUID' }),
96
+ (0, class_validator_1.IsString)(),
97
+ (0, class_validator_1.IsNotEmpty)(),
98
+ __metadata("design:type", String)
99
+ ], SatisfactionResponseDto.prototype, "patientId", void 0);
100
+ __decorate([
101
+ (0, swagger_1.ApiProperty)({ description: 'Appointment UUID' }),
102
+ (0, class_validator_1.IsString)(),
103
+ (0, class_validator_1.IsNotEmpty)(),
104
+ __metadata("design:type", String)
105
+ ], SatisfactionResponseDto.prototype, "appointmentId", void 0);
106
+ __decorate([
107
+ (0, swagger_1.ApiProperty)({
108
+ description: 'Type of satisfaction survey',
109
+ enum: exports.SATISFACTION_TYPES,
110
+ example: 'satisfaction_finished',
111
+ }),
112
+ (0, class_validator_1.IsIn)(exports.SATISFACTION_TYPES),
113
+ __metadata("design:type", String)
114
+ ], SatisfactionResponseDto.prototype, "satisfactionType", void 0);
115
+ __decorate([
116
+ (0, swagger_1.ApiProperty)({ description: 'Patient satisfaction rating (1-5)', example: 5 }),
117
+ (0, class_validator_1.IsInt)(),
118
+ (0, class_validator_1.Min)(1),
119
+ (0, class_validator_1.Max)(5),
120
+ __metadata("design:type", Number)
121
+ ], SatisfactionResponseDto.prototype, "rating", void 0);
122
+ __decorate([
123
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Optional text comment from the patient' }),
124
+ (0, class_validator_1.IsOptional)(),
125
+ (0, class_validator_1.IsString)(),
126
+ __metadata("design:type", Object)
127
+ ], SatisfactionResponseDto.prototype, "comment", void 0);
128
+ __decorate([
129
+ (0, swagger_1.ApiProperty)({ description: 'Timestamp when the response was recorded (ISO 8601)' }),
130
+ (0, class_validator_1.IsString)(),
131
+ (0, class_validator_1.IsNotEmpty)(),
132
+ __metadata("design:type", String)
133
+ ], SatisfactionResponseDto.prototype, "createdAt", void 0);
134
+ /**
135
+ * Response DTO for average satisfaction stats.
136
+ */
137
+ class SatisfactionAverageDto {
138
+ average;
139
+ count;
140
+ }
141
+ exports.SatisfactionAverageDto = SatisfactionAverageDto;
142
+ __decorate([
143
+ (0, swagger_1.ApiProperty)({ description: 'Average rating', example: 4.2 }),
144
+ __metadata("design:type", Number)
145
+ ], SatisfactionAverageDto.prototype, "average", void 0);
146
+ __decorate([
147
+ (0, swagger_1.ApiProperty)({ description: 'Total number of responses', example: 42 }),
148
+ __metadata("design:type", Number)
149
+ ], SatisfactionAverageDto.prototype, "count", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "DTOs compartilhados com class-validator (API e microserviços)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,11 +13,6 @@ export class FollowupConfigResponseDto {
13
13
  @IsNotEmpty()
14
14
  id: string;
15
15
 
16
- @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
17
- @IsString()
18
- @IsNotEmpty()
19
- tenant: string;
20
-
21
16
  @ApiPropertyOptional({ description: 'Tenant unit id', example: 1 })
22
17
  @IsOptional()
23
18
  @IsInt()
@@ -0,0 +1,111 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { IsBoolean, IsISO8601, IsOptional, IsString, IsUUID, MaxLength, MinLength } from 'class-validator';
3
+
4
+ export const TOPIC_MESSAGE_SENT = 'MESSAGE_SENT';
5
+ export const TOPIC_MESSAGE_RECEIVED = 'MESSAGE_RECEIVED';
6
+ export const TOPIC_FOLLOWUP_CONFIG_UPDATED = 'FOLLOWUP_CONFIG_UPDATED';
7
+ export const TOPIC_APPOINTMENT_CHANGED = 'APPOINTMENT_CHANGED';
8
+
9
+ export class FollowupConversationEventPayload {
10
+ @ApiProperty({ example: 'homolog' })
11
+ @IsString()
12
+ @MinLength(1)
13
+ @MaxLength(255)
14
+ tenant: string;
15
+
16
+ @ApiProperty({ example: '3c593727-4505-495a-a054-c052acb4cf19' })
17
+ @IsString()
18
+ @MinLength(1)
19
+ @MaxLength(255)
20
+ patientId: string;
21
+
22
+ @ApiProperty({ example: 'f3f50ecb-fb71-4d4b-a0dd-910ef6e3fd0a' })
23
+ @IsUUID()
24
+ sessionUuid: string;
25
+
26
+ @ApiProperty({ required: false, example: 1 })
27
+ @IsOptional()
28
+ unitId?: number;
29
+
30
+ @ApiProperty({ example: 'ia' })
31
+ @IsString()
32
+ @MinLength(1)
33
+ @MaxLength(50)
34
+ messageType: 'ia' | 'human' | 'patient';
35
+
36
+ @ApiProperty({ required: false, example: false })
37
+ @IsOptional()
38
+ @IsBoolean()
39
+ isFollowup?: boolean;
40
+
41
+ @ApiProperty({ example: '2026-03-30T12:03:14.000Z' })
42
+ @IsISO8601()
43
+ occurredAt: string;
44
+ }
45
+
46
+ export class FollowupConfigUpdatedEventPayload {
47
+ @ApiProperty({ example: 'homolog' })
48
+ @IsString()
49
+ @MinLength(1)
50
+ @MaxLength(255)
51
+ tenant: string;
52
+
53
+ @ApiProperty({ required: false, example: 1 })
54
+ @IsOptional()
55
+ unitId?: number;
56
+
57
+ @ApiProperty({
58
+ description: 'Serialized follow-up configuration snapshot stored in cache.',
59
+ type: Object,
60
+ })
61
+ config: Record<string, unknown>;
62
+
63
+ @ApiProperty({ example: '2026-03-30T12:03:14.000Z' })
64
+ @IsISO8601()
65
+ occurredAt: string;
66
+ }
67
+
68
+ export class AppointmentChangedEventPayload {
69
+ @ApiProperty({ example: 'homolog' })
70
+ @IsString()
71
+ @MinLength(1)
72
+ @MaxLength(255)
73
+ tenant: string;
74
+
75
+ @ApiProperty({ example: 'f3f50ecb-fb71-4d4b-a0dd-910ef6e3fd0a' })
76
+ @IsUUID()
77
+ appointmentId: string;
78
+
79
+ @ApiProperty({ example: '3c593727-4505-495a-a054-c052acb4cf19' })
80
+ @IsString()
81
+ @MinLength(1)
82
+ @MaxLength(255)
83
+ patientId: string;
84
+
85
+ @ApiProperty({ example: 'sended' })
86
+ @IsString()
87
+ @MinLength(1)
88
+ @MaxLength(50)
89
+ status: string;
90
+
91
+ @ApiProperty({ required: false, example: 'pending' })
92
+ @IsOptional()
93
+ @IsString()
94
+ @MaxLength(50)
95
+ previousStatus?: string;
96
+
97
+ @ApiProperty({ required: false, example: '2026-03-30T15:00:00.000Z' })
98
+ @IsOptional()
99
+ @IsISO8601()
100
+ date?: string;
101
+
102
+ @ApiProperty({ required: false, example: '2026-03-30T16:00:00.000Z' })
103
+ @IsOptional()
104
+ @IsISO8601()
105
+ exitTime?: string;
106
+
107
+ @ApiProperty({ example: '2026-03-30T12:03:14.000Z' })
108
+ @IsISO8601()
109
+ occurredAt: string;
110
+ }
111
+
@@ -12,11 +12,6 @@ export class FollowupLogResponseDto {
12
12
  @IsNotEmpty()
13
13
  id: string;
14
14
 
15
- @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
16
- @IsString()
17
- @IsNotEmpty()
18
- tenant: string;
19
-
20
15
  @ApiPropertyOptional({ description: 'Session UUID from conversation_sessions (null for appointment-based)' })
21
16
  @IsOptional()
22
17
  @IsString()
@@ -7,3 +7,5 @@ export * from './conversation-response.dto';
7
7
  export * from './followup-type.dto';
8
8
  export * from './followup-config-response.dto';
9
9
  export * from './followup-log-response.dto';
10
+ export * from './satisfaction-response.dto';
11
+ export * from './followup-events.dto';
@@ -0,0 +1,116 @@
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import {
3
+ IsIn,
4
+ IsInt,
5
+ IsNotEmpty,
6
+ IsOptional,
7
+ IsString,
8
+ Max,
9
+ MaxLength,
10
+ Min,
11
+ } from 'class-validator';
12
+
13
+ /** Valid satisfaction survey types. */
14
+ export const SATISFACTION_TYPES = [
15
+ 'satisfaction_booking',
16
+ 'satisfaction_finished',
17
+ ] as const;
18
+
19
+ export type SatisfactionTypeDto = (typeof SATISFACTION_TYPES)[number];
20
+
21
+ /**
22
+ * Payload to save a patient's satisfaction rating.
23
+ * Sent from the conversation-service to the followup-service
24
+ * when the AI detects a numeric satisfaction response.
25
+ */
26
+ export class SaveSatisfactionRequestDto {
27
+ @ApiProperty({ description: 'Tenant slug', example: 'clinic-alpha' })
28
+ @IsString()
29
+ @IsNotEmpty()
30
+ tenant: string;
31
+
32
+ @ApiProperty({ description: 'Patient UUID' })
33
+ @IsString()
34
+ @IsNotEmpty()
35
+ patientId: string;
36
+
37
+ @ApiProperty({ description: 'Appointment UUID linked to the satisfaction survey' })
38
+ @IsString()
39
+ @IsNotEmpty()
40
+ appointmentId: string;
41
+
42
+ @ApiProperty({
43
+ description: 'Type of satisfaction survey',
44
+ enum: SATISFACTION_TYPES,
45
+ example: 'satisfaction_booking',
46
+ })
47
+ @IsIn(SATISFACTION_TYPES)
48
+ satisfactionType: SatisfactionTypeDto;
49
+
50
+ @ApiProperty({ description: 'Patient satisfaction rating (1-5)', example: 4 })
51
+ @IsInt()
52
+ @Min(1)
53
+ @Max(5)
54
+ rating: number;
55
+
56
+ @ApiPropertyOptional({ description: 'Optional text comment from the patient', example: 'Otimo atendimento!' })
57
+ @IsOptional()
58
+ @IsString()
59
+ @MaxLength(2000)
60
+ comment?: string;
61
+ }
62
+
63
+ /**
64
+ * Response DTO for a saved satisfaction rating.
65
+ */
66
+ export class SatisfactionResponseDto {
67
+ @ApiProperty({ description: 'Primary key (UUID)' })
68
+ @IsString()
69
+ @IsNotEmpty()
70
+ id: string;
71
+
72
+ @ApiProperty({ description: 'Patient UUID' })
73
+ @IsString()
74
+ @IsNotEmpty()
75
+ patientId: string;
76
+
77
+ @ApiProperty({ description: 'Appointment UUID' })
78
+ @IsString()
79
+ @IsNotEmpty()
80
+ appointmentId: string;
81
+
82
+ @ApiProperty({
83
+ description: 'Type of satisfaction survey',
84
+ enum: SATISFACTION_TYPES,
85
+ example: 'satisfaction_finished',
86
+ })
87
+ @IsIn(SATISFACTION_TYPES)
88
+ satisfactionType: SatisfactionTypeDto;
89
+
90
+ @ApiProperty({ description: 'Patient satisfaction rating (1-5)', example: 5 })
91
+ @IsInt()
92
+ @Min(1)
93
+ @Max(5)
94
+ rating: number;
95
+
96
+ @ApiPropertyOptional({ description: 'Optional text comment from the patient' })
97
+ @IsOptional()
98
+ @IsString()
99
+ comment?: string | null;
100
+
101
+ @ApiProperty({ description: 'Timestamp when the response was recorded (ISO 8601)' })
102
+ @IsString()
103
+ @IsNotEmpty()
104
+ createdAt: string;
105
+ }
106
+
107
+ /**
108
+ * Response DTO for average satisfaction stats.
109
+ */
110
+ export class SatisfactionAverageDto {
111
+ @ApiProperty({ description: 'Average rating', example: 4.2 })
112
+ average: number;
113
+
114
+ @ApiProperty({ description: 'Total number of responses', example: 42 })
115
+ count: number;
116
+ }