feat: add appointment notification sharing functionality via WhatsApp, email, and system clipboard

This commit is contained in:
2026-07-29 14:38:13 -03:00
parent 3d8911c093
commit 2a33f636a0
19 changed files with 679 additions and 5 deletions
@@ -9,6 +9,7 @@ const BASE_RETRY_DELAY_MS = 5000;
const MAX_JITTER_MS = 3000;
const THROTTLE_RETRY_DELAY_MS = 8000;
const DEFAULT_CLEANUP_INTERVAL_MS = 60 * 60 * 1000;
const CLEANUP_RETENTION_DAYS = 7;
const SUPPORTED_APPOINTMENT_NOTIFICATION_TYPES = new Set(["creation", "reminder", "cancellation"]);
function resolveCleanupIntervalMs(): number {
@@ -41,6 +42,12 @@ export function buildStartOfDay(date: Date): Date {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
export function buildCleanupCutoff(now: Date): Date {
const cutoff = buildStartOfDay(now);
cutoff.setDate(cutoff.getDate() - CLEANUP_RETENTION_DAYS);
return cutoff;
}
function getJobId(job: { id?: unknown; _id?: unknown; appointmentId?: unknown; channel?: unknown; get?: (path: string) => unknown }): string {
const value = job.id || job._id || job.get?.("_id");
if (value) return String(value);
@@ -91,7 +98,7 @@ export class JobProcessor {
}
private async cleanupOldJobs(now = new Date()): Promise<void> {
const cutoff = buildStartOfDay(now);
const cutoff = buildCleanupCutoff(now);
try {
const deletedCount = await this.jobModel.deleteBeforeScheduledAt(cutoff);