feat: full clinera platform — auth, appointments, WhatsApp, chatbot canvas, reminders, leads, campaigns, inbox

This commit is contained in:
Obaid alah Saleh
2026-03-13 12:45:14 +02:00
parent fe044c91b4
commit 66a3568d01
195 changed files with 41621 additions and 4568 deletions
+53
View File
@@ -0,0 +1,53 @@
// Schedule reminders for recent appointments
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
// Import the reminder scheduling function
const { scheduleReminders, sendBookingConfirmation } = require('./src/lib/reminders.ts');
async function main() {
console.log('📅 Finding recent appointments...');
const appointments = await prisma.appointment.findMany({
where: {
status: { in: ['scheduled', 'confirmed'] },
dateTime: { gte: new Date() }
},
include: {
clinic: true,
lead: true,
treatment: true
},
orderBy: { createdAt: 'desc' },
take: 5
});
console.log(`Found ${appointments.length} appointments to schedule reminders for:`);
for (const apt of appointments) {
console.log(`📋 ${apt.lead.name} - ${apt.treatment.name} on ${apt.dateTime}`);
try {
await scheduleReminders(apt.id);
console.log(` ✅ Reminders scheduled`);
// Send immediate booking confirmation
await sendBookingConfirmation(apt.id);
console.log(` 📨 Booking confirmation sent`);
} catch (error) {
console.log(` ❌ Error: ${error.message}`);
}
}
// Check final reminder count
const reminderCount = await prisma.scheduledReminder.count({
where: { status: 'pending' }
});
console.log(`\n📊 Total pending reminders: ${reminderCount}`);
await prisma.$disconnect();
}
main().catch(console.error);