const db = require('../src/config/database'); async function seedDatabase() { try { console.log('🌱 Starting database seeding...'); // Seed guides const guides = [ { name: 'Kim Min-jun', email: 'minjun@koreatourism.com', phone: '+82-10-1234-5678', bio: 'Experienced Seoul city guide with 8 years of expertise in Korean history and culture. Fluent in English, Japanese, and Chinese.', specialization: 'city', languages: ['Korean', 'English', 'Japanese', 'Chinese'], experience: 8, hourly_rate: 50000 }, { name: 'Park So-young', email: 'soyoung@koreatourism.com', phone: '+82-10-2345-6789', bio: 'Mountain hiking specialist with deep knowledge of Korean national parks. Safety-certified guide with wilderness first aid training.', specialization: 'mountain', languages: ['Korean', 'English'], experience: 6, hourly_rate: 45000 }, { name: 'Lee Sung-ho', email: 'sungho@koreatourism.com', phone: '+82-10-3456-7890', bio: 'Professional fishing guide specializing in coastal and river fishing. 10 years of experience with traditional Korean fishing techniques.', specialization: 'fishing', languages: ['Korean', 'English'], experience: 10, hourly_rate: 60000 }, { name: 'Choi Yeon-seo', email: 'yeonseo@koreatourism.com', phone: '+82-10-4567-8901', bio: 'Cultural heritage expert specializing in traditional Korean architecture and temples. PhD in Korean History.', specialization: 'city', languages: ['Korean', 'English', 'Mandarin'], experience: 12, hourly_rate: 55000 } ]; for (const guide of guides) { await db.query(` INSERT INTO guides (name, email, phone, bio, specialization, languages, experience, hourly_rate) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT (email) DO NOTHING `, [guide.name, guide.email, guide.phone, guide.bio, guide.specialization, guide.languages, guide.experience, guide.hourly_rate]); } console.log('✅ Guides seeded successfully'); // Get guide IDs for routes const guideRows = await db.query('SELECT id, name, specialization FROM guides ORDER BY id'); const guideMap = {}; guideRows.rows.forEach(guide => { if (!guideMap[guide.specialization]) guideMap[guide.specialization] = []; guideMap[guide.specialization].push(guide.id); }); // Seed routes const routes = [ { title: 'Historic Seoul Walking Tour', description: 'Explore the ancient palaces and traditional markets of Seoul with our expert guide.', content: 'Discover the rich history of Seoul through a comprehensive walking tour that covers Gyeongbokgung Palace, Bukchon Hanok Village, and Insadong traditional market. Learn about Korean royal history, traditional architecture, and sample authentic Korean street food.', type: 'city', price: 75000, duration: 4, difficulty_level: 'easy', max_group_size: 15, included_services: ['Professional guide', 'Traditional tea ceremony', 'Palace entrance fees'], meeting_point: 'Gyeongbokgung Palace Main Gate', guide_id: guideMap.city ? guideMap.city[0] : null, is_featured: true }, { title: 'Seoraksan National Park Hiking', description: 'Experience the breathtaking beauty of Seoraksan with guided mountain hiking.', content: 'Join us for an unforgettable hiking experience in Seoraksan National Park. This moderate-level hike takes you through stunning mountain landscapes, ancient temples, and offers spectacular views from the peaks. Perfect for nature lovers and photography enthusiasts.', type: 'mountain', price: 120000, duration: 8, difficulty_level: 'moderate', max_group_size: 8, included_services: ['Certified mountain guide', 'Safety equipment', 'Traditional lunch', 'Transportation'], meeting_point: 'Sokcho Bus Terminal', guide_id: guideMap.mountain ? guideMap.mountain[0] : null, is_featured: true }, { title: 'East Sea Fishing Adventure', description: 'Traditional Korean fishing experience in the beautiful East Sea.', content: 'Learn traditional Korean fishing techniques while enjoying the scenic beauty of the East Sea. Our experienced guide will teach you about local marine life, traditional fishing methods, and you\'ll enjoy a fresh seafood lunch prepared from your catch.', type: 'fishing', price: 95000, duration: 6, difficulty_level: 'easy', max_group_size: 6, included_services: ['Fishing equipment', 'Boat charter', 'Fresh seafood lunch', 'Professional guide'], meeting_point: 'Gangneung Harbor', guide_id: guideMap.fishing ? guideMap.fishing[0] : null, is_featured: true }, { title: 'Busan Coastal City Tour', description: 'Discover the vibrant coastal city of Busan with its beaches, temples, and markets.', content: 'Explore Busan\'s highlights including Haeundae Beach, Jagalchi Fish Market, Gamcheon Culture Village, and Beomeosa Temple. Experience the unique culture of Korea\'s largest port city.', type: 'city', price: 85000, duration: 6, difficulty_level: 'easy', max_group_size: 12, included_services: ['Professional guide', 'Market tasting', 'Temple entrance', 'Local transportation'], meeting_point: 'Busan Station', guide_id: guideMap.city ? guideMap.city[1] : null, is_featured: false }, { title: 'Jirisan Mountain Expedition', description: 'Challenge yourself with a multi-day trek through Korea\'s largest national park.', content: 'Experience the wilderness of Jirisan National Park on this challenging multi-day expedition. Trek through ancient forests, visit remote temples, and enjoy spectacular mountain vistas.', type: 'mountain', price: 250000, duration: 16, difficulty_level: 'hard', max_group_size: 4, included_services: ['Expert guide', 'Camping equipment', 'All meals', 'Emergency support'], meeting_point: 'Jirisan National Park Visitor Center', guide_id: guideMap.mountain ? guideMap.mountain[0] : null, is_featured: false }, { title: 'Jeju Island Fishing Charter', description: 'Deep sea fishing adventure around the beautiful Jeju Island.', content: 'Experience world-class deep sea fishing in the waters around Jeju Island. Target species include tuna, marlin, and various local fish while enjoying the stunning volcanic island scenery.', type: 'fishing', price: 180000, duration: 10, difficulty_level: 'moderate', max_group_size: 8, included_services: ['Charter boat', 'Professional crew', 'Equipment', 'Lunch', 'Fish preparation'], meeting_point: 'Jeju Harbor', guide_id: guideMap.fishing ? guideMap.fishing[0] : null, is_featured: false } ]; for (const route of routes) { await db.query(` INSERT INTO routes ( title, description, content, type, price, duration, difficulty_level, max_group_size, included_services, meeting_point, guide_id, is_featured ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) `, [ route.title, route.description, route.content, route.type, route.price, route.duration, route.difficulty_level, route.max_group_size, route.included_services, route.meeting_point, route.guide_id, route.is_featured ]); } console.log('✅ Routes seeded successfully'); // Seed articles const adminResult = await db.query('SELECT id FROM admins LIMIT 1'); const adminId = adminResult.rows[0]?.id; const articles = [ { title: 'Best Time to Visit Korea: A Seasonal Guide', excerpt: 'Discover when to visit Korea for the perfect weather and experiences throughout the year.', content: `Korea offers something special in every season, making it a year-round destination... Spring (March-May): Cherry blossoms bloom across the country, creating stunning pink canopies. This is perhaps the most popular time to visit Korea. The weather is mild and perfect for outdoor activities. Summer (June-August): Hot and humid with occasional monsoons. Great for mountain hiking and coastal activities. Many festivals happen during this time. Autumn (September-November): Spectacular fall foliage and comfortable temperatures. Ideal for hiking and sightseeing. Clear skies offer great mountain views. Winter (December-February): Cold but beautiful, especially with snow. Perfect for winter sports and enjoying hot springs. Christmas and New Year celebrations add to the charm.`, category: 'travel-tips', author_id: adminId, is_published: true }, { title: 'Korean Temple Etiquette: Respectful Visiting Tips', excerpt: 'Learn the proper way to visit Korean Buddhist temples and show respect for local customs.', content: `Visiting Korean temples can be a deeply spiritual and cultural experience. Here are essential tips for respectful temple visits... Dress Code: Wear modest clothing that covers shoulders and knees. Avoid revealing or tight clothing. Behavior: Maintain quiet voices and respectful demeanor. Remove hats and sunglasses before entering temple halls. Photography: Ask permission before taking photos of people, especially monks. Some areas may prohibit photography entirely. Temple Stay: Many temples offer overnight experiences where you can participate in meditation and daily temple life.`, category: 'culture', author_id: adminId, is_published: true }, { title: 'Korean Street Food You Must Try', excerpt: 'A delicious guide to Korea\'s most popular street foods and where to find them.', content: `Korean street food is an adventure for your taste buds. Here are the must-try dishes... Tteokbokki: Spicy rice cakes in gochujang sauce, a Korean comfort food classic. Hotteok: Sweet pancakes filled with sugar, nuts, and cinnamon, perfect for cold days. Bungeoppang: Fish-shaped pastries filled with sweet red bean paste. Kimbap: Korean rice rolls with various fillings, perfect for a quick meal. Odeng: Fish cake soup served hot from street vendors, especially popular in winter.`, category: 'food', author_id: adminId, is_published: true } ]; for (const article of articles) { await db.query(` INSERT INTO articles (title, excerpt, content, category, author_id, is_published) VALUES ($1, $2, $3, $4, $5, $6) `, [article.title, article.excerpt, article.content, article.category, article.author_id, article.is_published]); } console.log('✅ Articles seeded successfully'); console.log('✨ Database seeding completed successfully!'); process.exit(0); } catch (error) { console.error('❌ Seeding failed:', error); process.exit(1); } } if (require.main === module) { seedDatabase(); } module.exports = { seedDatabase };