- Create Economist SubmissionTracking package correctly: * mainArticle = full blog post content * coverLetter = 216-word SIR— letter * Links to blog post via blogPostId - Archive 'Letter to The Economist' from blog posts (it's the cover letter) - Fix date display on article cards (use published_at) - Target publication already displaying via blue badge Database changes: - Make blogPostId optional in SubmissionTracking model - Economist package ID: 68fa85ae49d4900e7f2ecd83 - Le Monde package ID: 68fa2abd2e6acd5691932150 Next: Enhanced modal with tabs, validation, export 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
89 lines
2.3 KiB
JavaScript
89 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Check which of the 34 public documents are missing PDFs
|
|
*/
|
|
require('dotenv').config();
|
|
|
|
const { connect, close } = require('../src/utils/db.util');
|
|
const Document = require('../src/models/Document.model');
|
|
const fs = require('fs').promises;
|
|
const path = require('path');
|
|
|
|
const PUBLIC_CATEGORIES = [
|
|
'getting-started',
|
|
'technical-reference',
|
|
'research-theory',
|
|
'advanced-topics',
|
|
'case-studies',
|
|
'business-leadership',
|
|
'archives'
|
|
];
|
|
|
|
async function main() {
|
|
await connect();
|
|
|
|
const { MongoClient } = require('mongodb');
|
|
const mongoose = require('mongoose');
|
|
const { getCollection } = require('../src/utils/db.util');
|
|
|
|
const collection = await getCollection('documents');
|
|
|
|
const docs = await collection.find({
|
|
category: { $in: PUBLIC_CATEGORIES }
|
|
}).sort({ category: 1, order: 1 }).toArray();
|
|
|
|
console.log('\n' + '='.repeat(70));
|
|
console.log('PDF AVAILABILITY CHECK - 34 Public Documents');
|
|
console.log('='.repeat(70) + '\n');
|
|
|
|
const pdfDir = '/home/theflow/projects/tractatus/public/downloads';
|
|
|
|
let missingCount = 0;
|
|
let presentCount = 0;
|
|
const missing = [];
|
|
|
|
for (const doc of docs) {
|
|
const slug = doc.slug;
|
|
const pdfPath = path.join(pdfDir, `${slug}.pdf`);
|
|
|
|
try {
|
|
await fs.access(pdfPath);
|
|
presentCount++;
|
|
// console.log(`✅ ${doc.title}`);
|
|
} catch (err) {
|
|
missingCount++;
|
|
missing.push({ title: doc.title, slug, category: doc.category });
|
|
console.log(`❌ MISSING PDF: ${doc.title}`);
|
|
console.log(` slug: ${slug}`);
|
|
console.log(` category: ${doc.category}`);
|
|
console.log();
|
|
}
|
|
}
|
|
|
|
console.log('='.repeat(70));
|
|
console.log(`\n📊 Summary:`);
|
|
console.log(` ✅ PDFs present: ${presentCount}/${docs.length}`);
|
|
console.log(` ❌ PDFs missing: ${missingCount}/${docs.length}`);
|
|
|
|
if (missing.length > 0) {
|
|
console.log(`\n📋 Missing PDFs by category:`);
|
|
const byCategory = {};
|
|
missing.forEach(m => {
|
|
if (!byCategory[m.category]) byCategory[m.category] = [];
|
|
byCategory[m.category].push(m);
|
|
});
|
|
|
|
Object.keys(byCategory).forEach(cat => {
|
|
console.log(`\n ${cat}: ${byCategory[cat].length} missing`);
|
|
byCategory[cat].forEach(m => {
|
|
console.log(` - ${m.slug}`);
|
|
});
|
|
});
|
|
}
|
|
|
|
console.log('\n' + '='.repeat(70) + '\n');
|
|
|
|
await close();
|
|
}
|
|
|
|
main();
|