Files
canina/backend/prisma/clean-faqs.ts
T
2026-11-07 15:58:01 +00:00

36 lines
1.1 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function cleanFaqs() {
console.log('--- Cleaning Misplaced Content Tasks from FAQs ---');
const countBefore = await prisma.fAQ.count();
console.log(`Total FAQs before cleanup: ${countBefore}`);
const deleteResult = await prisma.fAQ.deleteMany({
where: {
OR: [
{ question: { contains: 'راهنمای' } },
{ question: { contains: 'اینفوگرافیک' } },
{ question: { contains: 'نگارش' } },
{ question: { contains: 'تدوین' } },
{ question: { contains: 'تولید' } },
{ question: { contains: 'مقاله' } },
],
},
});
console.log(`Successfully deleted ${deleteResult.count} misplaced content tasks.`);
const countAfter = await prisma.fAQ.count();
console.log(`Total real customer FAQs remaining: ${countAfter}`);
}
cleanFaqs()
.catch((err) => {
console.error('Clean FAQs error:', err);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});