Files
filezzy-staging/backend/scripts/add-pdf-to-epub-tool.ts
2026-02-04 14:16:04 +01:00

91 lines
3.3 KiB
TypeScript

/**
* One-off script: add the pdf-to-epub tool (and batch variant) to the database.
* Run from backend: npx ts-node scripts/add-pdf-to-epub-tool.ts
* Then export: npm run db:export-tools-json -- prisma/tools.json
*/
import { PrismaClient, AccessLevel, ProcessingType } from '@prisma/client';
const prisma = new PrismaClient();
const PDF_TO_EPUB_TOOL = {
slug: 'pdf-to-epub',
category: 'pdf',
name: 'PDF to EPUB',
description: 'Convert PDF to ebook format (EPUB or AZW3 for Kindle).',
accessLevel: AccessLevel.GUEST,
countsAsOperation: true,
dockerService: 'stirling-pdf',
processingType: ProcessingType.API,
isActive: true,
metaTitle: 'Convert PDF to EPUB - PDF to Ebook Online | Filezzy',
metaDescription: 'Convert PDF files to EPUB or AZW3 ebook format. Free online PDF to EPUB converter for e-readers and Kindle.',
nameLocalized: { en: 'PDF to EPUB', fr: 'PDF en EPUB' },
descriptionLocalized: {
en: 'Convert PDF to ebook format (EPUB or AZW3 for Kindle).',
fr: 'Convertir PDF en format ebook (EPUB ou AZW3 pour Kindle).',
},
metaTitleLocalized: {
en: 'Convert PDF to EPUB - PDF to Ebook Online | Filezzy',
fr: 'Convertir PDF en EPUB - PDF vers ebook en ligne | Filezzy',
},
metaDescriptionLocalized: {
en: 'Convert PDF files to EPUB or AZW3 ebook format. Free online PDF to EPUB converter for e-readers and Kindle.',
fr: 'Convertissez PDF en EPUB ou AZW3. Convertisseur PDF vers EPUB gratuit en ligne pour liseuses et Kindle.',
},
};
const BATCH_PDF_TO_EPUB_TOOL = {
slug: 'batch-pdf-to-epub',
category: 'batch',
name: 'Batch PDF to EPUB',
description: 'Convert multiple PDFs to EPUB or AZW3 at once.',
accessLevel: AccessLevel.GUEST,
countsAsOperation: true,
dockerService: 'stirling-pdf',
processingType: ProcessingType.API,
isActive: true,
metaTitle: 'Batch PDF to EPUB - Convert Multiple PDFs to Ebook | Filezzy',
metaDescription: 'Convert multiple PDF files to EPUB or AZW3 at once. Free batch PDF to EPUB converter.',
nameLocalized: { en: 'Batch PDF to EPUB', fr: 'PDF en EPUB par lot' },
descriptionLocalized: {
en: 'Convert multiple PDFs to EPUB or AZW3 at once.',
fr: 'Convertir plusieurs PDF en EPUB ou AZW3 en une fois.',
},
metaTitleLocalized: {
en: 'Batch PDF to EPUB - Convert Multiple PDFs to Ebook | Filezzy',
fr: 'PDF vers EPUB par lot | Filezzy',
},
metaDescriptionLocalized: {
en: 'Convert multiple PDF files to EPUB or AZW3 at once. Free batch PDF to EPUB converter.',
fr: 'Convertissez plusieurs PDF en EPUB ou AZW3 en une fois. Convertisseur PDF vers EPUB par lot gratuit.',
},
};
async function main() {
console.log('\nAdding pdf-to-epub and batch-pdf-to-epub tools...\n');
await prisma.tool.upsert({
where: { slug: PDF_TO_EPUB_TOOL.slug },
create: PDF_TO_EPUB_TOOL,
update: PDF_TO_EPUB_TOOL,
});
console.log(' ✅ pdf-to-epub upserted');
await prisma.tool.upsert({
where: { slug: BATCH_PDF_TO_EPUB_TOOL.slug },
create: BATCH_PDF_TO_EPUB_TOOL,
update: BATCH_PDF_TO_EPUB_TOOL,
});
console.log(' ✅ batch-pdf-to-epub upserted');
console.log('\nDone. To refresh prisma/tools.json run: npm run db:export-tools-json -- prisma/tools.json\n');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(() => prisma.$disconnect());