tychat-contracts 1.6.75 → 1.6.78
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/analytics/event-analytic.enum.d.ts +1 -1
- package/dist/analytics/event-analytic.enum.d.ts.map +1 -1
- package/dist/analytics/event-analytic.enum.js +4 -0
- package/dist/anamneses/normalize-anamnesis-access-token.d.ts +9 -0
- package/dist/anamneses/normalize-anamnesis-access-token.d.ts.map +1 -0
- package/dist/anamneses/normalize-anamnesis-access-token.js +21 -0
- package/dist/anamneses/normalize-anamnesis-access-token.spec.d.ts +2 -0
- package/dist/anamneses/normalize-anamnesis-access-token.spec.d.ts.map +1 -0
- package/dist/anamneses/normalize-anamnesis-access-token.spec.js +18 -0
- package/dist/appointments/appointment-status.dto.d.ts +1 -1
- package/dist/appointments/appointment-status.dto.d.ts.map +1 -1
- package/dist/appointments/appointment-status.dto.js +1 -0
- package/dist/appointments/index.d.ts +2 -0
- package/dist/appointments/index.d.ts.map +1 -1
- package/dist/appointments/index.js +2 -0
- package/dist/appointments/schedule-block-rmq-patterns.d.ts +7 -0
- package/dist/appointments/schedule-block-rmq-patterns.d.ts.map +1 -0
- package/dist/appointments/schedule-block-rmq-patterns.js +9 -0
- package/dist/appointments/schedule-block.dto.d.ts +54 -0
- package/dist/appointments/schedule-block.dto.d.ts.map +1 -0
- package/dist/appointments/schedule-block.dto.js +223 -0
- package/package.json +1 -1
- package/src/analytics/event-analytic.enum.ts +5 -0
- package/src/appointments/appointment-status.dto.ts +1 -0
- package/src/appointments/index.ts +3 -1
- package/src/appointments/schedule-block-rmq-patterns.ts +6 -0
- package/src/appointments/schedule-block.dto.ts +155 -0
- package/src/campaigns/campaign-template-header-media.dto.ts +25 -25
- package/src/campaigns/campaign-template.dto.ts +45 -45
- package/src/campaigns/create-campaign.dto.ts +80 -80
- package/src/patients/index.ts +10 -10
- package/src/tenants/anamnesis-public-frontend-url.spec.ts +45 -45
- package/src/tenants/anamnesis-public-frontend-url.ts +61 -61
- package/dist/connections/connections.dto.d.ts +0 -53
- package/dist/connections/connections.dto.d.ts.map +0 -1
- package/dist/connections/connections.dto.js +0 -376
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Enum of all analytic event types emitted by microservices.
|
|
3
3
|
* Each value follows the pattern: `domain.action`.
|
|
4
4
|
*/
|
|
5
|
-
export declare const EVENT_ANALYTIC_TYPES: readonly ["patient.created", "patient.updated", "patient.deleted", "patient.status_changed", "appointment.created", "appointment.updated", "appointment.canceled", "appointment.rescheduled", "appointment.no_show", "appointment.finished", "appointment.procedure_finished", "checkin.effectued", "checkout.effectued", "message.sent", "message.received", "conversation.session_started", "conversation.session_ended", "conversation.transferred_to_human", "followup.abandonment.sent", "followup.appointment_confirmation.sent", "followup.appointment_confirmation.confirmed", "followup.appointment_confirmation.reschedule_requested", "followup.satisfaction_booking.sent", "followup.satisfaction_finished.sent", "followup.no_show_reschedule.sent", "followup.checkin_not_completed.sent", "followup.wellness_check.sent", "followup.return_suggestion.sent", "followup.satisfaction_booking.response_received", "followup.satisfaction_finished.response_received", "followup.config_updated", "payment.created", "payment.payed", "payment.refunded", "payment.canceled", "payment.overdue", "payment_gateway.payment_created", "payment_gateway.payment_confirmed", "payment_gateway.payment_failed", "payment_gateway.payment_refunded", "payment_gateway.payment_canceled", "payment_gateway.payment_expired", "payment_gateway.webhook_received", "billing.invoice_created", "billing.invoice_paid", "ai.interaction", "ai.fallback", "auth.login", "auth.logout", "auth.password_reset", "user.created", "user.updated", "user.deleted", "notification.sent", "notification.failed", "whatsapp.connection_established", "whatsapp.connection_lost", "whatsapp.official.credits.consume.failed", "whatsapp_credits.recharged", "procedure.created", "procedure.updated", "procedure.deleted", "specialty.created", "specialty.updated", "specialty.deleted", "professional.created", "professional.updated", "professional.deleted", "configuration.updated", "legal_term.template.updated", "storage.file_uploaded", "storage.file_deleted", "tenant.created", "tenant.updated"];
|
|
5
|
+
export declare const EVENT_ANALYTIC_TYPES: readonly ["patient.created", "patient.updated", "patient.deleted", "patient.status_changed", "appointment.created", "appointment.updated", "appointment.canceled", "appointment.rescheduled", "appointment.rescheduled.schedule_block", "appointment.no_show", "appointment.finished", "appointment.procedure_finished", "schedule_block.created", "schedule_block.reschedule_expired", "checkin.effectued", "checkout.effectued", "message.sent", "message.received", "conversation.session_started", "conversation.session_ended", "conversation.transferred_to_human", "followup.abandonment.sent", "followup.appointment_confirmation.sent", "followup.appointment_confirmation.confirmed", "followup.appointment_confirmation.reschedule_requested", "followup.satisfaction_booking.sent", "followup.satisfaction_finished.sent", "followup.no_show_reschedule.sent", "followup.checkin_not_completed.sent", "followup.wellness_check.sent", "followup.return_suggestion.sent", "followup.satisfaction_booking.response_received", "followup.satisfaction_finished.response_received", "followup.config_updated", "payment.created", "payment.payed", "payment.refunded", "payment.canceled", "payment.overdue", "payment_gateway.payment_created", "payment_gateway.payment_confirmed", "payment_gateway.payment_failed", "payment_gateway.payment_refunded", "payment_gateway.payment_canceled", "payment_gateway.payment_expired", "payment_gateway.webhook_received", "billing.invoice_created", "billing.invoice_paid", "ai.interaction", "ai.fallback", "auth.login", "auth.logout", "auth.password_reset", "user.created", "user.updated", "user.deleted", "notification.sent", "notification.failed", "whatsapp.connection_established", "whatsapp.connection_lost", "whatsapp.official.credits.consume.failed", "whatsapp_credits.recharged", "procedure.created", "procedure.updated", "procedure.deleted", "specialty.created", "specialty.updated", "specialty.deleted", "professional.created", "professional.updated", "professional.deleted", "configuration.updated", "legal_term.template.updated", "storage.file_uploaded", "storage.file_deleted", "tenant.created", "tenant.updated"];
|
|
6
6
|
export type EventAnalyticType = (typeof EVENT_ANALYTIC_TYPES)[number];
|
|
7
7
|
//# sourceMappingURL=event-analytic.enum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-analytic.enum.d.ts","sourceRoot":"","sources":["../../src/analytics/event-analytic.enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"event-analytic.enum.d.ts","sourceRoot":"","sources":["../../src/analytics/event-analytic.enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,glEA0HvB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -16,10 +16,14 @@ exports.EVENT_ANALYTIC_TYPES = [
|
|
|
16
16
|
'appointment.updated',
|
|
17
17
|
'appointment.canceled',
|
|
18
18
|
'appointment.rescheduled',
|
|
19
|
+
'appointment.rescheduled.schedule_block',
|
|
19
20
|
'appointment.no_show',
|
|
20
21
|
'appointment.finished',
|
|
21
22
|
/** Procedimento do agendamento marcado como concluído (add/update com finished). */
|
|
22
23
|
'appointment.procedure_finished',
|
|
24
|
+
// ── Schedule block events ───────────────────────────────────────
|
|
25
|
+
'schedule_block.created',
|
|
26
|
+
'schedule_block.reschedule_expired',
|
|
23
27
|
// ── Check-in / Check-out events ─────────────────────────────────
|
|
24
28
|
'checkin.effectued',
|
|
25
29
|
'checkout.effectued',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Hex length of `randomBytes(32).toString('hex')` anamnesis tokens. */
|
|
2
|
+
export declare const ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH = 64;
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a raw token from URL/query/WhatsApp linkification.
|
|
5
|
+
* Meta templates often place punctuation right after {{1}} (e.g. "{{1}}."),
|
|
6
|
+
* which mobile clients include in the tapped URL and breaks SHA-256 lookup.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeAnamnesisAccessToken(raw: string | null | undefined): string;
|
|
9
|
+
//# sourceMappingURL=normalize-anamnesis-access-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-anamnesis-access-token.d.ts","sourceRoot":"","sources":["../../src/anamneses/normalize-anamnesis-access-token.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAYpF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH = void 0;
|
|
4
|
+
exports.normalizeAnamnesisAccessToken = normalizeAnamnesisAccessToken;
|
|
5
|
+
/** Hex length of `randomBytes(32).toString('hex')` anamnesis tokens. */
|
|
6
|
+
exports.ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH = 64;
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes a raw token from URL/query/WhatsApp linkification.
|
|
9
|
+
* Meta templates often place punctuation right after {{1}} (e.g. "{{1}}."),
|
|
10
|
+
* which mobile clients include in the tapped URL and breaks SHA-256 lookup.
|
|
11
|
+
*/
|
|
12
|
+
function normalizeAnamnesisAccessToken(raw) {
|
|
13
|
+
const trimmed = (raw ?? '').trim();
|
|
14
|
+
if (!trimmed)
|
|
15
|
+
return '';
|
|
16
|
+
const exact = trimmed.match(new RegExp(`^([a-fA-F0-9]{${exports.ANAMNESIS_ACCESS_TOKEN_HEX_LENGTH}})`));
|
|
17
|
+
if (exact?.[1]) {
|
|
18
|
+
return exact[1].toLowerCase();
|
|
19
|
+
}
|
|
20
|
+
return trimmed.replace(/[.,;:!?)>\]"']+$/g, '').trim();
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-anamnesis-access-token.spec.d.ts","sourceRoot":"","sources":["../../src/anamneses/normalize-anamnesis-access-token.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const normalize_anamnesis_access_token_1 = require("./normalize-anamnesis-access-token");
|
|
4
|
+
const TOKEN = '22d58c2cd36a147d464d1525cfd45657bd42491276bdc9ae5bef580d70b57168';
|
|
5
|
+
describe('normalizeAnamnesisAccessToken', () => {
|
|
6
|
+
it('returns valid 64-char hex token unchanged (lowercased)', () => {
|
|
7
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(TOKEN)).toBe(TOKEN);
|
|
8
|
+
});
|
|
9
|
+
it('strips trailing period from WhatsApp linkification', () => {
|
|
10
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(`${TOKEN}.`)).toBe(TOKEN);
|
|
11
|
+
});
|
|
12
|
+
it('strips trailing punctuation cluster', () => {
|
|
13
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(`${TOKEN}).`)).toBe(TOKEN);
|
|
14
|
+
});
|
|
15
|
+
it('returns empty for blank input', () => {
|
|
16
|
+
expect((0, normalize_anamnesis_access_token_1.normalizeAnamnesisAccessToken)(' ')).toBe('');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const APPOINTMENT_STATUSES: readonly ["pending", "processing", "in_care", "sended", "finished", "canceled", "no_show"];
|
|
1
|
+
export declare const APPOINTMENT_STATUSES: readonly ["pending", "processing", "in_care", "sended", "finished", "canceled", "no_show", "pending_reschedule"];
|
|
2
2
|
export type AppointmentStatusDto = (typeof APPOINTMENT_STATUSES)[number];
|
|
3
3
|
/**
|
|
4
4
|
* Appointment types to differentiate regular appointments from return visits.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appointment-status.dto.d.ts","sourceRoot":"","sources":["../../src/appointments/appointment-status.dto.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"appointment-status.dto.d.ts","sourceRoot":"","sources":["../../src/appointments/appointment-status.dto.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,kHASvB,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gCAAiC,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -9,4 +9,6 @@ export * from './appointment-procedure.dto';
|
|
|
9
9
|
export * from './update-appointment-procedure.dto';
|
|
10
10
|
export * from './care-queue.dto';
|
|
11
11
|
export * from './appointment-calendar.dto';
|
|
12
|
+
export * from './schedule-block.dto';
|
|
13
|
+
export * from './schedule-block-rmq-patterns';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appointments/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appointments/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC"}
|
|
@@ -25,3 +25,5 @@ __exportStar(require("./appointment-procedure.dto"), exports);
|
|
|
25
25
|
__exportStar(require("./update-appointment-procedure.dto"), exports);
|
|
26
26
|
__exportStar(require("./care-queue.dto"), exports);
|
|
27
27
|
__exportStar(require("./appointment-calendar.dto"), exports);
|
|
28
|
+
__exportStar(require("./schedule-block.dto"), exports);
|
|
29
|
+
__exportStar(require("./schedule-block-rmq-patterns"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SCHEDULE_BLOCKS_PREVIEW = "scheduleBlocks.preview";
|
|
2
|
+
export declare const SCHEDULE_BLOCKS_APPLY = "scheduleBlocks.apply";
|
|
3
|
+
export declare const SCHEDULE_BLOCKS_FIND_IN_RANGE = "scheduleBlocks.findInRange";
|
|
4
|
+
export declare const SCHEDULE_BLOCKS_REMOVE = "scheduleBlocks.remove";
|
|
5
|
+
export declare const SCHEDULE_BLOCKS_EXPIRE_PENDING = "scheduleBlocks.expirePending";
|
|
6
|
+
export declare const SCHEDULE_BLOCKS_COMPLETE_RESCHEDULE = "scheduleBlocks.completeReschedule";
|
|
7
|
+
//# sourceMappingURL=schedule-block-rmq-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-block-rmq-patterns.d.ts","sourceRoot":"","sources":["../../src/appointments/schedule-block-rmq-patterns.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAC5D,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAC1E,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAC9D,eAAO,MAAM,8BAA8B,iCAAiC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SCHEDULE_BLOCKS_COMPLETE_RESCHEDULE = exports.SCHEDULE_BLOCKS_EXPIRE_PENDING = exports.SCHEDULE_BLOCKS_REMOVE = exports.SCHEDULE_BLOCKS_FIND_IN_RANGE = exports.SCHEDULE_BLOCKS_APPLY = exports.SCHEDULE_BLOCKS_PREVIEW = void 0;
|
|
4
|
+
exports.SCHEDULE_BLOCKS_PREVIEW = 'scheduleBlocks.preview';
|
|
5
|
+
exports.SCHEDULE_BLOCKS_APPLY = 'scheduleBlocks.apply';
|
|
6
|
+
exports.SCHEDULE_BLOCKS_FIND_IN_RANGE = 'scheduleBlocks.findInRange';
|
|
7
|
+
exports.SCHEDULE_BLOCKS_REMOVE = 'scheduleBlocks.remove';
|
|
8
|
+
exports.SCHEDULE_BLOCKS_EXPIRE_PENDING = 'scheduleBlocks.expirePending';
|
|
9
|
+
exports.SCHEDULE_BLOCKS_COMPLETE_RESCHEDULE = 'scheduleBlocks.completeReschedule';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare class ScheduleBlockIntervalDto {
|
|
2
|
+
startAt: string;
|
|
3
|
+
endAt: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SCHEDULE_BLOCK_CONFLICT_ACTIONS: readonly ["cancel", "ai_reschedule"];
|
|
6
|
+
export type ScheduleBlockConflictActionDto = (typeof SCHEDULE_BLOCK_CONFLICT_ACTIONS)[number];
|
|
7
|
+
export declare class ScheduleBlockConflictActionDtoClass {
|
|
8
|
+
appointmentId: string;
|
|
9
|
+
action: ScheduleBlockConflictActionDto;
|
|
10
|
+
}
|
|
11
|
+
export declare class PreviewScheduleBlockDto {
|
|
12
|
+
userId: string;
|
|
13
|
+
intervals: ScheduleBlockIntervalDto[];
|
|
14
|
+
}
|
|
15
|
+
export declare class ScheduleBlockConflictDto {
|
|
16
|
+
appointmentId: string;
|
|
17
|
+
patientId: string;
|
|
18
|
+
patientName: string;
|
|
19
|
+
procedureNames: string[];
|
|
20
|
+
start: string;
|
|
21
|
+
end: string;
|
|
22
|
+
status: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class PreviewScheduleBlockResponseDto {
|
|
25
|
+
intervals: ScheduleBlockIntervalDto[];
|
|
26
|
+
conflicts: ScheduleBlockConflictDto[];
|
|
27
|
+
}
|
|
28
|
+
export declare class ApplyScheduleBlockDto extends PreviewScheduleBlockDto {
|
|
29
|
+
reason?: string;
|
|
30
|
+
createdByUserId: string;
|
|
31
|
+
conflictActions?: ScheduleBlockConflictActionDtoClass[];
|
|
32
|
+
}
|
|
33
|
+
export declare class ScheduleBlockDto {
|
|
34
|
+
id: string;
|
|
35
|
+
userId: string;
|
|
36
|
+
startAt: string;
|
|
37
|
+
endAt: string;
|
|
38
|
+
reason?: string | null;
|
|
39
|
+
createdByUserId: string;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
}
|
|
42
|
+
export declare class ApplyScheduleBlockResponseDto {
|
|
43
|
+
blocks: ScheduleBlockDto[];
|
|
44
|
+
cancelledAppointmentIds: string[];
|
|
45
|
+
aiRescheduleAppointmentIds: string[];
|
|
46
|
+
}
|
|
47
|
+
export declare class FindScheduleBlocksInRangeQueryDto {
|
|
48
|
+
userId: string;
|
|
49
|
+
startDate: string;
|
|
50
|
+
endDate: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const SCHEDULE_BLOCK_RESCHEDULE_STATUSES: readonly ["pending_patient", "confirmed", "expired", "cancelled"];
|
|
53
|
+
export type ScheduleBlockRescheduleStatusDto = (typeof SCHEDULE_BLOCK_RESCHEDULE_STATUSES)[number];
|
|
54
|
+
//# sourceMappingURL=schedule-block.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-block.dto.d.ts","sourceRoot":"","sources":["../../src/appointments/schedule-block.dto.ts"],"names":[],"mappings":"AAcA,qBAAa,wBAAwB;IAGnC,OAAO,EAAE,MAAM,CAAC;IAIhB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,+BAA+B,sCAAuC,CAAC;AACpF,MAAM,MAAM,8BAA8B,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9F,qBAAa,mCAAmC;IAG9C,aAAa,EAAE,MAAM,CAAC;IAItB,MAAM,EAAE,8BAA8B,CAAC;CACxC;AAED,qBAAa,uBAAuB;IAGlC,MAAM,EAAE,MAAM,CAAC;IAMf,SAAS,EAAE,wBAAwB,EAAE,CAAC;CACvC;AAED,qBAAa,wBAAwB;IAEnC,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,MAAM,CAAC;IAGlB,WAAW,EAAE,MAAM,CAAC;IAGpB,cAAc,EAAE,MAAM,EAAE,CAAC;IAGzB,KAAK,EAAE,MAAM,CAAC;IAGd,GAAG,EAAE,MAAM,CAAC;IAGZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,+BAA+B;IAE1C,SAAS,EAAE,wBAAwB,EAAE,CAAC;IAGtC,SAAS,EAAE,wBAAwB,EAAE,CAAC;CACvC;AAED,qBAAa,qBAAsB,SAAQ,uBAAuB;IAKhE,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,eAAe,EAAE,MAAM,CAAC;IAOxB,eAAe,CAAC,EAAE,mCAAmC,EAAE,CAAC;CACzD;AAED,qBAAa,gBAAgB;IAE3B,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,MAAM,CAAC;IAGhB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,eAAe,EAAE,MAAM,CAAC;IAGxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,6BAA6B;IAExC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAG3B,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAGlC,0BAA0B,EAAE,MAAM,EAAE,CAAC;CACtC;AAED,qBAAa,iCAAiC;IAG5C,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,MAAM,CAAC;IAIlB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kCAAkC,mEAKrC,CAAC;AACX,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,223 @@
|
|
|
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.SCHEDULE_BLOCK_RESCHEDULE_STATUSES = exports.FindScheduleBlocksInRangeQueryDto = exports.ApplyScheduleBlockResponseDto = exports.ScheduleBlockDto = exports.ApplyScheduleBlockDto = exports.PreviewScheduleBlockResponseDto = exports.ScheduleBlockConflictDto = exports.PreviewScheduleBlockDto = exports.ScheduleBlockConflictActionDtoClass = exports.SCHEDULE_BLOCK_CONFLICT_ACTIONS = exports.ScheduleBlockIntervalDto = 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
|
+
class ScheduleBlockIntervalDto {
|
|
17
|
+
startAt;
|
|
18
|
+
endAt;
|
|
19
|
+
}
|
|
20
|
+
exports.ScheduleBlockIntervalDto = ScheduleBlockIntervalDto;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, swagger_1.ApiProperty)({ description: 'Início do bloqueio (ISO 8601)', example: '2026-06-15T14:00:00.000Z' }),
|
|
23
|
+
(0, class_validator_1.IsDateString)(),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], ScheduleBlockIntervalDto.prototype, "startAt", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, swagger_1.ApiProperty)({ description: 'Fim do bloqueio (ISO 8601)', example: '2026-06-15T16:00:00.000Z' }),
|
|
28
|
+
(0, class_validator_1.IsDateString)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ScheduleBlockIntervalDto.prototype, "endAt", void 0);
|
|
31
|
+
exports.SCHEDULE_BLOCK_CONFLICT_ACTIONS = ['cancel', 'ai_reschedule'];
|
|
32
|
+
class ScheduleBlockConflictActionDtoClass {
|
|
33
|
+
appointmentId;
|
|
34
|
+
action;
|
|
35
|
+
}
|
|
36
|
+
exports.ScheduleBlockConflictActionDtoClass = ScheduleBlockConflictActionDtoClass;
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do agendamento em conflito' }),
|
|
39
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], ScheduleBlockConflictActionDtoClass.prototype, "appointmentId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({ enum: exports.SCHEDULE_BLOCK_CONFLICT_ACTIONS }),
|
|
44
|
+
(0, class_validator_1.IsEnum)(exports.SCHEDULE_BLOCK_CONFLICT_ACTIONS),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], ScheduleBlockConflictActionDtoClass.prototype, "action", void 0);
|
|
47
|
+
class PreviewScheduleBlockDto {
|
|
48
|
+
userId;
|
|
49
|
+
intervals;
|
|
50
|
+
}
|
|
51
|
+
exports.PreviewScheduleBlockDto = PreviewScheduleBlockDto;
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do profissional (userId)' }),
|
|
54
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], PreviewScheduleBlockDto.prototype, "userId", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({ type: [ScheduleBlockIntervalDto] }),
|
|
59
|
+
(0, class_validator_1.IsArray)(),
|
|
60
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
61
|
+
(0, class_transformer_1.Type)(() => ScheduleBlockIntervalDto),
|
|
62
|
+
__metadata("design:type", Array)
|
|
63
|
+
], PreviewScheduleBlockDto.prototype, "intervals", void 0);
|
|
64
|
+
class ScheduleBlockConflictDto {
|
|
65
|
+
appointmentId;
|
|
66
|
+
patientId;
|
|
67
|
+
patientName;
|
|
68
|
+
procedureNames;
|
|
69
|
+
start;
|
|
70
|
+
end;
|
|
71
|
+
status;
|
|
72
|
+
}
|
|
73
|
+
exports.ScheduleBlockConflictDto = ScheduleBlockConflictDto;
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, swagger_1.ApiProperty)(),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], ScheduleBlockConflictDto.prototype, "appointmentId", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, swagger_1.ApiProperty)(),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], ScheduleBlockConflictDto.prototype, "patientId", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, swagger_1.ApiProperty)(),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], ScheduleBlockConflictDto.prototype, "patientName", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, swagger_1.ApiProperty)({ type: [String] }),
|
|
88
|
+
__metadata("design:type", Array)
|
|
89
|
+
], ScheduleBlockConflictDto.prototype, "procedureNames", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, swagger_1.ApiProperty)(),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], ScheduleBlockConflictDto.prototype, "start", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, swagger_1.ApiProperty)(),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], ScheduleBlockConflictDto.prototype, "end", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, swagger_1.ApiProperty)(),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], ScheduleBlockConflictDto.prototype, "status", void 0);
|
|
102
|
+
class PreviewScheduleBlockResponseDto {
|
|
103
|
+
intervals;
|
|
104
|
+
conflicts;
|
|
105
|
+
}
|
|
106
|
+
exports.PreviewScheduleBlockResponseDto = PreviewScheduleBlockResponseDto;
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, swagger_1.ApiProperty)({ type: [ScheduleBlockIntervalDto] }),
|
|
109
|
+
__metadata("design:type", Array)
|
|
110
|
+
], PreviewScheduleBlockResponseDto.prototype, "intervals", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, swagger_1.ApiProperty)({ type: [ScheduleBlockConflictDto] }),
|
|
113
|
+
__metadata("design:type", Array)
|
|
114
|
+
], PreviewScheduleBlockResponseDto.prototype, "conflicts", void 0);
|
|
115
|
+
class ApplyScheduleBlockDto extends PreviewScheduleBlockDto {
|
|
116
|
+
reason;
|
|
117
|
+
createdByUserId;
|
|
118
|
+
conflictActions;
|
|
119
|
+
}
|
|
120
|
+
exports.ApplyScheduleBlockDto = ApplyScheduleBlockDto;
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'Motivo opcional do bloqueio', maxLength: 500 }),
|
|
123
|
+
(0, class_validator_1.IsOptional)(),
|
|
124
|
+
(0, class_validator_1.IsString)(),
|
|
125
|
+
(0, class_validator_1.MaxLength)(500),
|
|
126
|
+
__metadata("design:type", String)
|
|
127
|
+
], ApplyScheduleBlockDto.prototype, "reason", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do usuário que criou o bloqueio' }),
|
|
130
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
131
|
+
__metadata("design:type", String)
|
|
132
|
+
], ApplyScheduleBlockDto.prototype, "createdByUserId", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, swagger_1.ApiPropertyOptional)({ type: [ScheduleBlockConflictActionDtoClass] }),
|
|
135
|
+
(0, class_validator_1.IsOptional)(),
|
|
136
|
+
(0, class_validator_1.IsArray)(),
|
|
137
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
138
|
+
(0, class_transformer_1.Type)(() => ScheduleBlockConflictActionDtoClass),
|
|
139
|
+
__metadata("design:type", Array)
|
|
140
|
+
], ApplyScheduleBlockDto.prototype, "conflictActions", void 0);
|
|
141
|
+
class ScheduleBlockDto {
|
|
142
|
+
id;
|
|
143
|
+
userId;
|
|
144
|
+
startAt;
|
|
145
|
+
endAt;
|
|
146
|
+
reason;
|
|
147
|
+
createdByUserId;
|
|
148
|
+
createdAt;
|
|
149
|
+
}
|
|
150
|
+
exports.ScheduleBlockDto = ScheduleBlockDto;
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, swagger_1.ApiProperty)(),
|
|
153
|
+
__metadata("design:type", String)
|
|
154
|
+
], ScheduleBlockDto.prototype, "id", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
(0, swagger_1.ApiProperty)(),
|
|
157
|
+
__metadata("design:type", String)
|
|
158
|
+
], ScheduleBlockDto.prototype, "userId", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, swagger_1.ApiProperty)(),
|
|
161
|
+
__metadata("design:type", String)
|
|
162
|
+
], ScheduleBlockDto.prototype, "startAt", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, swagger_1.ApiProperty)(),
|
|
165
|
+
__metadata("design:type", String)
|
|
166
|
+
], ScheduleBlockDto.prototype, "endAt", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
169
|
+
__metadata("design:type", Object)
|
|
170
|
+
], ScheduleBlockDto.prototype, "reason", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, swagger_1.ApiProperty)(),
|
|
173
|
+
__metadata("design:type", String)
|
|
174
|
+
], ScheduleBlockDto.prototype, "createdByUserId", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
(0, swagger_1.ApiProperty)(),
|
|
177
|
+
__metadata("design:type", String)
|
|
178
|
+
], ScheduleBlockDto.prototype, "createdAt", void 0);
|
|
179
|
+
class ApplyScheduleBlockResponseDto {
|
|
180
|
+
blocks;
|
|
181
|
+
cancelledAppointmentIds;
|
|
182
|
+
aiRescheduleAppointmentIds;
|
|
183
|
+
}
|
|
184
|
+
exports.ApplyScheduleBlockResponseDto = ApplyScheduleBlockResponseDto;
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, swagger_1.ApiProperty)({ type: [ScheduleBlockDto] }),
|
|
187
|
+
__metadata("design:type", Array)
|
|
188
|
+
], ApplyScheduleBlockResponseDto.prototype, "blocks", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, swagger_1.ApiProperty)({ description: 'IDs de agendamentos cancelados' }),
|
|
191
|
+
__metadata("design:type", Array)
|
|
192
|
+
], ApplyScheduleBlockResponseDto.prototype, "cancelledAppointmentIds", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, swagger_1.ApiProperty)({ description: 'IDs de agendamentos com pedido de reagendamento IA iniciado' }),
|
|
195
|
+
__metadata("design:type", Array)
|
|
196
|
+
], ApplyScheduleBlockResponseDto.prototype, "aiRescheduleAppointmentIds", void 0);
|
|
197
|
+
class FindScheduleBlocksInRangeQueryDto {
|
|
198
|
+
userId;
|
|
199
|
+
startDate;
|
|
200
|
+
endDate;
|
|
201
|
+
}
|
|
202
|
+
exports.FindScheduleBlocksInRangeQueryDto = FindScheduleBlocksInRangeQueryDto;
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, swagger_1.ApiProperty)(),
|
|
205
|
+
(0, class_validator_1.IsUUID)('4'),
|
|
206
|
+
__metadata("design:type", String)
|
|
207
|
+
], FindScheduleBlocksInRangeQueryDto.prototype, "userId", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, swagger_1.ApiProperty)({ example: '2026-06-01' }),
|
|
210
|
+
(0, class_validator_1.IsDateString)(),
|
|
211
|
+
__metadata("design:type", String)
|
|
212
|
+
], FindScheduleBlocksInRangeQueryDto.prototype, "startDate", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
(0, swagger_1.ApiProperty)({ example: '2026-06-30' }),
|
|
215
|
+
(0, class_validator_1.IsDateString)(),
|
|
216
|
+
__metadata("design:type", String)
|
|
217
|
+
], FindScheduleBlocksInRangeQueryDto.prototype, "endDate", void 0);
|
|
218
|
+
exports.SCHEDULE_BLOCK_RESCHEDULE_STATUSES = [
|
|
219
|
+
'pending_patient',
|
|
220
|
+
'confirmed',
|
|
221
|
+
'expired',
|
|
222
|
+
'cancelled',
|
|
223
|
+
];
|
package/package.json
CHANGED
|
@@ -14,11 +14,16 @@ export const EVENT_ANALYTIC_TYPES = [
|
|
|
14
14
|
'appointment.updated',
|
|
15
15
|
'appointment.canceled',
|
|
16
16
|
'appointment.rescheduled',
|
|
17
|
+
'appointment.rescheduled.schedule_block',
|
|
17
18
|
'appointment.no_show',
|
|
18
19
|
'appointment.finished',
|
|
19
20
|
/** Procedimento do agendamento marcado como concluído (add/update com finished). */
|
|
20
21
|
'appointment.procedure_finished',
|
|
21
22
|
|
|
23
|
+
// ── Schedule block events ───────────────────────────────────────
|
|
24
|
+
'schedule_block.created',
|
|
25
|
+
'schedule_block.reschedule_expired',
|
|
26
|
+
|
|
22
27
|
// ── Check-in / Check-out events ─────────────────────────────────
|
|
23
28
|
'checkin.effectued',
|
|
24
29
|
'checkout.effectued',
|
|
@@ -8,4 +8,6 @@ export * from './appointment.dto';
|
|
|
8
8
|
export * from './appointment-procedure.dto';
|
|
9
9
|
export * from './update-appointment-procedure.dto';
|
|
10
10
|
export * from './care-queue.dto';
|
|
11
|
-
export * from './appointment-calendar.dto';
|
|
11
|
+
export * from './appointment-calendar.dto';
|
|
12
|
+
export * from './schedule-block.dto';
|
|
13
|
+
export * from './schedule-block-rmq-patterns';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SCHEDULE_BLOCKS_PREVIEW = 'scheduleBlocks.preview';
|
|
2
|
+
export const SCHEDULE_BLOCKS_APPLY = 'scheduleBlocks.apply';
|
|
3
|
+
export const SCHEDULE_BLOCKS_FIND_IN_RANGE = 'scheduleBlocks.findInRange';
|
|
4
|
+
export const SCHEDULE_BLOCKS_REMOVE = 'scheduleBlocks.remove';
|
|
5
|
+
export const SCHEDULE_BLOCKS_EXPIRE_PENDING = 'scheduleBlocks.expirePending';
|
|
6
|
+
export const SCHEDULE_BLOCKS_COMPLETE_RESCHEDULE = 'scheduleBlocks.completeReschedule';
|