fix(faq): move clean-faqs script to prisma dir for execution
Deploy Canina / deploy (push) Successful in 2m17s
Deploy Canina / deploy (push) Successful in 2m17s
This commit is contained in:
1 parent
27b61ce6d5
commit
468856538c
1 file changed
+35
@@ -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();
|
||||
});
|
||||
Reference in new issue
Block a user