Files
diabetix/add_readings.js
jeremy bayse e7f151d14e feat: Initial Diabetix application commit
- Add authentication with NextAuth v5 (credentials + email verification)
- Implement dashboard with glycemia tracking and AI analysis
- Add PDF report generation for Premium users
- Implement Stripe integration for Premium subscriptions
- Add responsive UI with Tailwind CSS and shadcn components
- Database schema with Prisma ORM and PostgreSQL support
- Real-time glycemia visualization with Recharts
- Mobile-optimized entry form
- User profile management with medical information
- Subscription lifecycle management (create, cancel, webhook)
- Email notifications with Resend
- Feature gates for Free vs Premium plans

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-26 23:06:29 +02:00

44 lines
1.3 KiB
JavaScript

const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
async function main() {
const user = await prisma.user.findUnique({
where: { email: "testuser@example.com" }
});
if (!user) {
console.log("User not found");
process.exit(1);
}
// Generate sample readings for the past 12 months
const readings = [];
const today = new Date();
for (let monthsAgo = 0; monthsAgo < 12; monthsAgo++) {
const monthDate = new Date(today.getFullYear(), today.getMonth() - monthsAgo, 1);
const daysInMonth = new Date(monthDate.getFullYear(), monthDate.getMonth() + 1, 0).getDate();
for (let day = 1; day <= daysInMonth; day += 2) { // Every 2 days
for (let time = 0; time < 3; time++) { // 3 times per day
readings.push({
userId: user.id,
value: Math.floor(Math.random() * 150) + 60, // 60-210 mg/dL
measuredAt: new Date(monthDate.getFullYear(), monthDate.getMonth(), day, 6 + time * 8, 0),
notes: time === 0 ? "Avant petit-déjeuner" : time === 1 ? "Avant déjeuner" : "Avant dîner"
});
}
}
}
await prisma.reading.createMany({
data: readings,
skipDuplicates: true
});
console.log(`Created ${readings.length} readings`);
await prisma.$disconnect();
}
main().catch(console.error);