My-Weekly-ToDo-List/clear-data.ts
mARTin 3e19ebe85a fix: security hardening, Prisma singleton, tsconfig cleanup
- tsconfig: remove deprecated downlevelIteration (es2017 has native iterators),
  change moduleResolution from node to bundler
- auth: set allowDangerousEmailAccountLinking=false on all OAuth providers,
  restrict debug mode to development only
- prisma: replace new PrismaClient() with singleton import in 10 API routes
  to prevent connection pool exhaustion
- goal API: validate user-supplied quote URLs to block SSRF (private IPs,
  non-http(s) schemes)
- email: guard DEV verification/reset link console.logs behind NODE_ENV check

v1.98.0
2026-04-20 19:52:47 +02:00

28 lines
697 B
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
const user = await prisma.user.findUnique({
where: { email: 'martin.bierschenk@gmail.com' }
});
if (!user) return;
// Delete all tasks in the target range created today
const res = await prisma.task.deleteMany({
where: {
userId: user.id,
scheduledDate: {
gte: new Date('2026-03-15T00:00:00Z'),
lte: new Date('2026-04-15T00:00:00Z')
},
createdAt: {
gte: new Date(new Date().setHours(0,0,0,0))
}
}
});
console.log(`Deleted ${res.count} tasks from martin`);
}
main().finally(() => prisma.$disconnect());