- 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>
52 lines
1.4 KiB
JavaScript
Executable file
52 lines
1.4 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
require('dotenv').config();
|
|
|
|
const { connect, close, getCollection } = require('../src/utils/db.util');
|
|
const User = require('../src/models/User.model');
|
|
|
|
const EMAIL = process.argv[2] || 'admin@agenticgovernance.digital';
|
|
const PASSWORD = process.argv[3] || 'TractatusDev2025';
|
|
const NAME = process.argv[4] || 'Admin User';
|
|
|
|
async function fixAdminUser() {
|
|
try {
|
|
await connect();
|
|
|
|
// Find existing admin user
|
|
const existing = await User.findByEmail(EMAIL);
|
|
|
|
if (existing) {
|
|
console.log(`✅ Found existing admin: ${existing.email} (ID: ${existing._id})`);
|
|
console.log(` Deleting...`);
|
|
await User.delete(existing._id);
|
|
console.log(`✅ Deleted old admin user`);
|
|
}
|
|
|
|
// Create new admin with proper password field
|
|
console.log(`\n📝 Creating new admin user...`);
|
|
const admin = await User.create({
|
|
name: NAME,
|
|
email: EMAIL,
|
|
password: PASSWORD,
|
|
role: 'admin',
|
|
active: true
|
|
});
|
|
|
|
console.log(`\n✅ Admin user created successfully!`);
|
|
console.log(` Email: ${admin.email}`);
|
|
console.log(` Password: ${PASSWORD}`);
|
|
console.log(` Role: ${admin.role}`);
|
|
console.log(` ID: ${admin._id}`);
|
|
console.log(`\n🔐 Test login at: POST /api/auth/login`);
|
|
|
|
await close();
|
|
process.exit(0);
|
|
|
|
} catch (error) {
|
|
console.error('\n❌ Error:', error.message);
|
|
await close();
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
fixAdminUser();
|