/* eslint-disable no-console */ const { env } = require("../config/env"); const { connectDB, disconnectDB } = require("../config/db"); const User = require("../models/User"); const Course = require("../models/Course"); const courses = [ { title: "Artificial Intelligence Essentials", slug: "artificial-intelligence-essentials", category: "Artificial Intelligence", price: 350, duration: "8 weeks", level: "Beginner", description: "A practical introduction to AI: learn what AI can (and cannot) do, work with real datasets, and build your first machine-learning models.", highlights: [ "AI concepts, terminology and real-world use cases", "Hands-on Python & ML experiments", "Build a simple predictive model end-to-end", ], }, { title: "Cyber Security Essentials", slug: "cyber-security-essentials", category: "Cyber Security", price: 300, duration: "6 weeks", level: "Beginner", description: "Learn the foundations of cyber defense: protect devices, networks, and data against the most common digital threats.", highlights: [ "Threat landscape and attacker tactics", "Secure browsing, password & identity hygiene", "Basic network and endpoint protection", ], }, { title: "AI-Powered Cybersecurity", slug: "ai-powered-cybersecurity", category: "Cyber Security", price: 550, duration: "10 weeks", level: "Intermediate to Advanced", description: "Combine AI with security operations: deploy intelligent threat detection, automate incident response, and build resilient SOC workflows.", highlights: [ "ML-based threat detection and anomaly analytics", "Automated incident response playbooks", "AI governance, ethics and adversarial risks", ], }, { title: "The AI Career Guidance", slug: "the-ai-career-guidance", category: "Professional Ethics", price: 200, duration: "4 weeks", level: "Career Foundations", description: "Map your path into the AI economy. Discover roles, build a portfolio, and prepare for interviews with guided mentorship.", highlights: [ "AI career landscape and skill roadmap", "Portfolio project planning and resume review", "Mock interviews and mentorship sessions", ], }, { title: "AI for Business Managers", slug: "ai-for-business-managers", category: "Professional Ethics", price: 450, duration: "6 weeks", level: "Manager Level", description: "Learn how to evaluate, procure, and manage AI projects that drive real business value without needing to code.", highlights: [ "AI strategy, ROI and use-case prioritisation", "Managing data, vendors and project risk", "Leading AI-enabled teams and change", ], }, { title: "AI for Business Executives", slug: "ai-for-business-executives", category: "Professional Ethics", price: 650, duration: "5 weeks", level: "Executive Level", description: "A leadership-level course on AI governance, competitive strategy, and building an AI-ready organisation.", highlights: [ "Board-level AI vision and investment decisions", "Regulatory, ethical and governance frameworks", "Building an AI culture and Centre of Excellence", ], }, ]; async function seed() { await connectDB(); for (const c of courses) { await Course.findOneAndUpdate({ slug: c.slug }, c, { upsert: true, new: true, setDefaultsOnInsert: true }); } console.log(`Seeded ${courses.length} courses.`); if (env.seedAdmin.email && env.seedAdmin.password) { const existingAdmin = await User.findOne({ email: env.seedAdmin.email.toLowerCase() }); if (existingAdmin) { console.log(`Admin account already exists for ${env.seedAdmin.email}, skipping.`); } else { const admin = new User({ name: env.seedAdmin.name, email: env.seedAdmin.email.toLowerCase(), role: "admin", }); await admin.setPassword(env.seedAdmin.password); await admin.save(); console.log(`Created admin account: ${env.seedAdmin.email}`); console.log("IMPORTANT: log in and change this password immediately."); } } else { console.log("SEED_ADMIN_EMAIL / SEED_ADMIN_PASSWORD not set — skipping admin creation."); } await disconnectDB(); process.exit(0); } seed().catch((err) => { console.error("Seeding failed:", err); process.exit(1); });