tractatus/scripts/verify-34-documents.js
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- 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>
2025-10-24 08:47:42 +13:00

65 lines
2.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Verify All 34 Public Documents
*
* Lists all 34 documents that should be visible on the frontend
*/
require('dotenv').config();
const { MongoClient } = require('mongodb');
async function verify34Documents() {
const client = new MongoClient('mongodb://localhost:27017');
try {
await client.connect();
const db = client.db('tractatus_dev');
const collection = db.collection('documents');
// Get documents with proper categories (not 'none')
const documents = await collection.find({
visibility: { $in: ['public', 'archived'] },
category: { $in: ['getting-started', 'technical-reference', 'research-theory', 'advanced-topics', 'case-studies', 'business-leadership', 'archives'] }
})
.sort({ category: 1, order: 1 })
.toArray();
console.log(`\n=== VERIFICATION: 34 Public Documents ===`);
console.log(`Found: ${documents.length} documents\n`);
const byCategory = {};
documents.forEach(doc => {
const cat = doc.category;
if (!byCategory[cat]) {
byCategory[cat] = [];
}
byCategory[cat].push({
order: doc.order,
title: doc.title,
slug: doc.slug,
visibility: doc.visibility || 'public',
sections: doc.sections ? doc.sections.length : 0
});
});
Object.keys(byCategory).sort().forEach(category => {
console.log(`\n━━━ ${category.toUpperCase()} (${byCategory[category].length} docs) ━━━`);
byCategory[category].forEach(doc => {
const sectionStatus = doc.sections > 0 ? `${doc.sections} sections` : `❌ No sections`;
console.log(`${doc.order}. ${doc.title}`);
console.log(` ${doc.slug} | ${doc.visibility} | ${sectionStatus}`);
});
});
console.log(`\n═══════════════════════════════════════════════════`);
console.log(`Total: ${documents.length} documents`);
await client.close();
} catch (error) {
console.error('Error:', error);
}
}
verify34Documents();