metallkart-erp/scripts/check-reminders.ts
louis 122b07a880 docs: session 148 rapports + artefact D1-D5 + CLAUDE.md update
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-29 20:07:29 +04:00

20 lines
773 B
TypeScript

import { PrismaClient } from '@prisma/client';
const p = new PrismaClient();
async function main() {
const all = await p.reminder.findMany({
orderBy: { scheduledFor: 'desc' },
take: 10,
select: { id: true, customMessage: true, scheduledFor: true, status: true, source: true, targetUserId: true },
});
console.log(`All reminders (latest 10): ${all.length}`);
for (const r of all) {
console.log(` ${r.source} | ${r.status} | ${r.scheduledFor.toISOString().slice(0, 16)} | ${r.customMessage?.slice(0, 40)}`);
}
const old = await p.reminder.deleteMany({ where: { source: 'AUTO_FROM_TASK', status: 'SENT' } });
if (old.count > 0) console.log(`\nDeleted ${old.count} old AUTO_FROM_TASK SENT reminders`);
}
main().finally(() => p.$disconnect());