diff --git a/backend/prisma/clean-faqs.ts b/backend/prisma/clean-faqs.ts new file mode 100644 index 00000000..3a530147 --- /dev/null +++ b/backend/prisma/clean-faqs.ts @@ -0,0 +1,35 @@ +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(); + });