require('dotenv').config(); const { getDb } = require('../config/database'); const logger = require('../config/logger'); const templates = [ { id: 'tmpl_modern_1', name: 'Modern Blue', description: 'Clean single-column with a professional blue touch.', category: 'modern', layout: 'single', thumbnail_url: 'assets/modern_blue.png', is_ats_safe: 1, is_premium: 0, tags: JSON.stringify(['clean', 'modern']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{else}}
Marketing Manager
{{/if}}
{{#if contact.phone}}
{{contact.phone}}
{{/if}} {{#if contact.email}}
{{contact.email}}
{{/if}} {{#if contact.linkedin}}
{{contact.linkedin}}
{{/if}} {{#if contact.location}}
{{contact.location}}
{{/if}}
{{#if summary}}

Professional Summary

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Professional Experience

{{#each experience}}

{{title}}

{{company}}
{{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}

{{institution}}

{{degree}}
{{endDate}}
{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}

{{name}}

{{#if link}}{{link}}{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}
{{name}}{{#if issuer}} - {{issuer}}{{/if}}
{{/each}}
{{/if}} {{#if skills.length}}

Skills

{{#each skills}}
{{this}}
{{/each}}
{{/if}} {{#if additional.length}}

Additional Information

{{#each additional}}
{{title}}: {{value}}
{{/each}}
{{/if}}
{{#if languages.length}}

Languages

{{#each languages}}
{{name}}: {{level}}
{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}}
{{title}} | {{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#2563EB{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Inter', sans-serif{{/if}}; } body { font-family: var(--font-family); color: #1e293b; line-height: var(--line-height, 1.4); } header.bleed-header { background: var(--primary); color: #ffffff; padding: 24px 30px; margin-top: calc(-1 * var(--margin-top)) !important; margin-right: calc(-1 * var(--margin-right)) !important; margin-left: calc(-1 * var(--margin-left)) !important; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; } .header-left h1 { font-size: 2.6em; color: #ffffff !important; margin: 0 0 4px 0; text-transform: uppercase; font-weight: 700; letter-spacing: -0.5px; } .title-sub { font-size: 1.2em; color: rgba(255, 255, 255, 0.85); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 500; } .header-right { text-align: right; font-size: 0.9em; line-height: 1.4; } .header-right div { margin-bottom: 2px; } h2 { font-size: 1.3em; border-bottom: 1.5px solid var(--primary); padding-bottom: 3px; margin-top: 18px; margin-bottom: 10px; color: var(--primary); text-transform: uppercase; font-weight: 700; } .item { margin-bottom: 12px; } .item-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; } .item-header h3 { font-size: 1.1em; font-weight: 700; margin: 0; color: #1e293b; text-transform: uppercase; } .company { font-style: italic; color: #475569; font-size: 0.95em; margin-top: 2px; } .degree { color: #475569; font-size: 0.95em; margin-top: 2px; } .date { font-size: 0.95em; color: #475569; font-weight: 500; text-align: right; white-space: nowrap; } .skills-list { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; } .skill-item { font-size: 1em; color: #1e293b; display: flex; align-items: center; gap: 6px; } .skill-item::before { content: "•"; color: var(--primary); font-weight: bold; } p { margin: 0; font-size: 1em; color: #334155; } ` }, { id: 'tmpl_classic_1', name: 'Classic Serif', description: 'Traditional serif layout for legal and corporate roles.', category: 'classic', layout: 'single', thumbnail_url: 'assets/classic_serif.png', is_ats_safe: 1, is_premium: 0, tags: JSON.stringify(['classic', 'serif']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{/if}}
{{contact.email}} • {{contact.phone}} • {{contact.location}} {{#if contact.linkedin}} • LI: {{contact.linkedin}}{{/if}} {{#if contact.github}} • GH: {{contact.github}}{{/if}}
{{#if summary}}

Summary

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Experience

{{#each experience}}

{{title}} | {{company}}

{{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}

{{degree}}

{{endDate}}

{{institution}}

{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}

{{name}}

{{#if link}}
{{link}}
{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}

{{name}}

{{date}}

{{issuer}}

{{/each}}
{{/if}} {{#if skills.length}}

Skills

Expertise: {{join skills ", "}}

{{/if}} {{#if additional.length}}

Additional Information

{{#each additional}}

{{title}}: {{value}}

{{/each}}
{{/if}} {{#if languages.length}}

Languages

{{#each languages}}{{name}} ({{level}}){{#unless @last}}, {{/unless}}{{/each}}

{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}} - {{title}} ({{contact}})
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#000000{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Merriweather', serif{{/if}}; } body { font-family: var(--font-family); color: #000; line-height: var(--line-height, 1.3); } h2 { font-size: 1.2em; text-transform: uppercase; border-bottom: 1px solid #000; margin-top: 12px; margin-bottom: 5px; font-weight: bold; } .item { margin-bottom: 8px; } .item h3 { font-size: 1.1em; margin: 0; font-weight: bold; } .date { font-style: italic; font-size: 0.95em; margin-bottom: 2px; } p { font-size: 1em; margin: 0; } ` }, { id: 'tmpl_creative_1', name: 'Creative Mint', description: 'Fresh two-column layout for creative professionals.', category: 'creative', layout: 'two-column', thumbnail_url: 'assets/creative_mint.png', is_ats_safe: 0, is_premium: 1, tags: JSON.stringify(['creative', 'mint']), html_content: `
{{#if summary}}

Profile

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Experience

{{#each experience}}

{{title}}

{{company}} | {{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}

{{name}}

{{#if link}}{{link}}{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}

{{name}}

{{issuer}} | {{date}}
{{/each}}
{{/if}} {{#if additional.length}}

Additional

{{#each additional}}
{{title}}:

{{value}}

{{/each}}
{{/if}} {{#if languages.length}}

Languages

{{#each languages}}
{{name}}: {{level}}
{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}}
{{title}} | {{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#166534{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Source Sans Pro', sans-serif{{/if}}; } body { font-family: var(--font-family); color: #1e293b; margin: 0; line-height: var(--line-height, 1.4); } h2 { font-size: 1.5em; color: #166534; border-bottom: 2px solid #f0fdf4; padding-bottom: 5px; margin-bottom: 15px; } h3 { font-size: 1.3em; margin-bottom: 4px; } p { font-size: 1em; margin: 0; } ` }, { id: 'tmpl_dark_1', name: 'Midnight Professional', description: 'Striking dark-themed header for a bold impression.', category: 'modern', layout: 'single', thumbnail_url: 'assets/dark_pro.png', is_ats_safe: 1, is_premium: 1, tags: JSON.stringify(['dark', 'bold']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{/if}}
{{contact.email}} | {{contact.phone}} | {{contact.location}} {{#if contact.linkedin}} | LI: {{contact.linkedin}}{{/if}} {{#if contact.github}} | GH: {{contact.github}}{{/if}}
{{#if summary}}

Professional Summary

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Experience

{{#each experience}}

{{title}} @ {{company}}

{{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}

{{degree}}

{{endDate}}

{{institution}}

{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}

{{name}}

{{#if link}}{{link}}{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}

{{name}}

{{issuer}} | {{date}}
{{/each}}
{{/if}} {{#if skills.length}}

Expertise

{{#each skills}}{{this}}{{/each}}
{{/if}} {{#if additional.length}}

Additional Info

{{#each additional}}

{{title}}

{{value}}

{{/each}}
{{/if}} {{#if languages.length}}

Languages

{{#each languages}}
{{name}} • {{level}}
{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}

{{name}}

{{title}} | {{contact}}

{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#0f172a{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Inter', sans-serif{{/if}}; } body { font-family: var(--font-family); color: #1e293b; line-height: var(--line-height, 1.4); } h2 { color: #0f172a; font-size: 1.3em; text-transform: uppercase; letter-spacing: 1px; border-bottom: 2px solid #0f172a; padding-bottom: 3px; margin-top: 15px; } h3 { font-size: 1.15em; margin: 0; font-weight: 700; } .date { font-size: 0.9em; color: #64748b; font-weight: 500; } .skills-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .skill-tag { background: #0f172a; color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 0.85em; } p { font-size: 1em; margin: 0; } ` }, { id: 'tmpl_minimal_1', name: 'Minimalist Executive', description: 'High-impact minimalist design for senior professionals.', category: 'modern', layout: 'single', thumbnail_url: 'assets/minimal_executive.png', is_ats_safe: 1, is_premium: 1, tags: JSON.stringify(['minimal', 'executive', 'clean']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{/if}}
{{contact.email}} • {{contact.phone}} • {{contact.location}} {{#if contact.linkedin}} • LinkedIn: {{contact.linkedin}}{{/if}} {{#if contact.github}} • GitHub: {{contact.github}}{{/if}}
{{#if summary}}
{{#if summary}}

{{nl2br summary}}

{{/if}}
{{/if}} {{#if experience.length}}

Experience

{{#each experience}}
{{title}} @ {{company}}{{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}
{{degree}}{{endDate}}

{{institution}}

{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}
{{name}}{{#if link}}{{link}}{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}
{{name}}{{date}}

{{issuer}}

{{/each}}
{{/if}} {{#if skills.length}}

Skills

{{join skills ", "}}

{{/if}} {{#if additional.length}}

Additional

{{#each additional}}
{{title}}: {{value}}
{{/each}}
{{/if}} {{#if languages.length}}

Languages

{{#each languages}}{{name}}: {{level}}{{#unless @last}} • {{/unless}}{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}} ({{title}}) - {{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#6366f1{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Inter', sans-serif{{/if}}; } body { font-family: var(--font-family); background: #fff; color: #1e293b; line-height: var(--line-height, 1.4); } h2 { border-bottom: none !important; } ` }, { id: 'tmpl_tech_1', name: 'Tech Professional', description: 'Modern, skill-focused layout for developers and engineers.', category: 'modern', layout: 'single', thumbnail_url: 'assets/tech_pro.png', is_ats_safe: 1, is_premium: 0, tags: JSON.stringify(['tech', 'modern', 'skills']), html_content: `

{{contact.name}}

{{#if contact.title}}{{contact.title}}{{else}}Software Engineer{{/if}}

{{contact.email}}
{{contact.phone}}
{{contact.location}}
{{#if contact.linkedin}}
LI: {{contact.linkedin}}
{{/if}} {{#if contact.github}}
GH: {{contact.github}}
{{/if}}
{{#if summary}}

About Me

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Work Experience

{{#each experience}}
{{title}} | {{company}}
{{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}
{{name}}{{#if link}} | Link{{/if}}

{{nl2br description}}

{{/each}}
{{/if}}
{{#if skills.length}}

Tech Stack

{{#each skills}}{{this}}{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}
{{degree}}
{{institution}}
{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}
{{name}}
{{issuer}} | {{date}}
{{/each}}
{{/if}} {{#if additional.length}}

Extra Info

{{#each additional}}
{{title}}

{{value}}

{{/each}}
{{/if}} {{#if languages.length}}

Languages

{{#each languages}}
{{name}}: {{level}}
{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}}
{{title}}
{{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#4f46e5{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Inter', sans-serif{{/if}}; } body { font-family: var(--font-family); color: #1e293b; line-height: var(--line-height, 1.4); } h3 { font-size: 1.1em; text-transform: uppercase; color: #64748b; border-bottom: 1px solid #e2e8f0; padding-bottom: 5px; margin-bottom: 15px; } ` }, { id: 'tmpl_standard_1', name: 'Standard Business', description: 'A reliable, classic choice that passes every ATS system.', category: 'classic', layout: 'single', thumbnail_url: 'assets/standard_business.png', is_ats_safe: 1, is_premium: 0, tags: JSON.stringify(['classic', 'standard', 'ats']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{/if}}

{{contact.email}} | {{contact.phone}} | {{contact.location}} {{#if contact.linkedin}} | LI: {{contact.linkedin}}{{/if}} {{#if contact.github}} | GH: {{contact.github}}{{/if}}

{{#if summary}}

PROFESSIONAL SUMMARY

{{nl2br summary}}

{{/if}} {{#if experience.length}}

EXPERIENCE

{{#each experience}}
{{company}}{{startDate}} - {{endDate}}
{{title}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

EDUCATION

{{#each education}}
{{institution}}{{endDate}}
{{degree}}
{{/each}}
{{/if}} {{#if projects.length}}

PROJECTS

{{#each projects}}
{{name}}
{{#if link}}
{{link}}
{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

CERTIFICATIONS

{{#each certifications}}
{{name}}{{date}}
{{issuer}}
{{/each}}
{{/if}} {{#if skills.length}}

SKILLS

{{join skills ", "}}

{{/if}} {{#if additional.length}}

ADDITIONAL INFORMATION

{{#each additional}}
{{title}}: {{value}}
{{/each}}
{{/if}} {{#if languages.length}}

LANGUAGES

{{#each languages}}{{name}} ({{level}}){{#unless @last}}, {{/unless}}{{/each}}

{{/if}} {{#if references.length}}

REFERENCES

{{#each references}}
{{name}}
{{title}} | {{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#000000{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Times New Roman', serif{{/if}}; } body { font-family: var(--font-family); color: #000; line-height: var(--line-height, 1.3); } ` }, { id: 'tmpl_academic_1', name: 'Academic Professional', description: 'Clean, detailed layout optimized for research and academic roles.', category: 'classic', layout: 'single', thumbnail_url: 'assets/academic_pro.png', is_ats_safe: 1, is_premium: 0, tags: JSON.stringify(['academic', 'professional', 'detailed']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{/if}}

{{contact.email}} | {{contact.phone}} | {{contact.location}} {{#if contact.linkedin}} | LinkedIn: {{contact.linkedin}}{{/if}} {{#if contact.github}} | GitHub: {{contact.github}}{{/if}}

{{#if summary}}

Research Profile

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Academic Experience

{{#each experience}}
{{title}}, {{company}}
{{startDate}} - {{endDate}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}
{{degree}}
{{institution}} | Graduated {{endDate}}
{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}
{{name}} ({{issuer}}, {{date}})
{{/each}}
{{/if}} {{#if skills.length}}

Technical Skills

{{join skills ", "}}

{{/if}} {{#if additional.length}}

Additional Details

{{#each additional}}
{{title}}: {{value}}
{{/each}}
{{/if}}
{{#if languages.length}}

Languages

{{#each languages}}
{{name}} ({{level}})
{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}}
{{title}}
{{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#2d3748{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Crimson Pro', serif{{/if}}; } body { font-family: var(--font-family); line-height: var(--line-height, 1.5); } ` }, { id: 'tmpl_corporate_2', name: 'Corporate Sleek', description: 'Modern corporate layout with a distinctive left border accent.', category: 'modern', layout: 'single', thumbnail_url: 'assets/corporate_sleek.png', is_ats_safe: 1, is_premium: 1, tags: JSON.stringify(['corporate', 'sleek', 'modern']), html_content: `

{{contact.name}}

{{#if contact.title}}
{{contact.title}}
{{/if}}

{{contact.email}} • {{contact.phone}} • {{contact.location}} {{#if contact.linkedin}} • LI: {{contact.linkedin}}{{/if}} {{#if contact.github}} • GH: {{contact.github}}{{/if}}

{{#if summary}}

About Me

{{nl2br summary}}

{{/if}} {{#if experience.length}}

Professional History

{{#each experience}}
{{title}}{{startDate}} - {{endDate}}
{{company}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if education.length}}

Education

{{#each education}}
{{degree}}
{{institution}} | Graduated {{endDate}}
{{/each}}
{{/if}} {{#if skills.length}}

Core Expertise

{{#each skills}}{{this}}{{/each}}
{{/if}} {{#if projects.length}}

Projects

{{#each projects}}
{{name}}{{#if link}}{{link}}{{/if}}

{{nl2br description}}

{{/each}}
{{/if}} {{#if certifications.length}}

Certifications

{{#each certifications}}
{{name}}{{date}}
{{issuer}}
{{/each}}
{{/if}}
{{#if languages.length}}

Languages

{{#each languages}}
{{name}}: {{level}}
{{/each}}
{{/if}} {{#if references.length}}

References

{{#each references}}
{{name}} • {{contact}}
{{/each}}
{{/if}}
`, css_content: ` :root { --primary: {{#if design.primaryColor}}{{design.primaryColor}}{{else}}#1e293b{{/if}}; --font-family: {{#if design.fontFamily}}{{{design.fontFamily}}}{{else}}'Inter', sans-serif{{/if}}; } body { font-family: var(--font-family); line-height: var(--line-height, 1.4); } ` } ]; const writingTips = [ { id: 'tip_1', section: 'summary', tip: 'Focus on achievements, not just tasks.', example: 'Saved 20% on server costs by optimizing database queries.' }, { id: 'tip_2', section: 'experience', tip: 'Use action verbs to start each bullet point.', example: 'Managed, Created, Developed, Improved' }, { id: 'tip_3', section: 'experience', tip: 'Quantify your accomplishments with numbers.', example: 'Increased sales by 30%, Reduced costs by $50K' }, { id: 'tip_4', section: 'education', tip: 'Include relevant coursework and academic projects.', example: 'Data Structures, Machine Learning, Web Development' }, { id: 'tip_5', section: 'skills', tip: 'List both technical and soft skills.', example: 'Python, JavaScript, Leadership, Communication' } ]; async function seed() { try { const db = await getDb(); await db.run('PRAGMA foreign_keys = OFF'); await db.run('DELETE FROM templates'); await db.run('DELETE FROM writing_tips'); for (const tmpl of templates) { await db.run( `INSERT INTO templates (id, name, description, category, layout, thumbnail_url, html_content, css_content, is_ats_safe, is_premium, tags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, tmpl.id, tmpl.name, tmpl.description, tmpl.category, tmpl.layout, tmpl.thumbnail_url, tmpl.html_content, tmpl.css_content, tmpl.is_ats_safe, tmpl.is_premium, tmpl.tags ); } for (const tip of writingTips) { await db.run('INSERT INTO writing_tips (id, section, tip, example) VALUES (?, ?, ?, ?)', tip.id, tip.section, tip.tip, tip.example); } await db.run('PRAGMA foreign_keys = ON'); logger.info(`Seeded ${templates.length} templates successfully!`); process.exit(0); } catch (err) { logger.error(`Seeding failed: ${err.message}`); process.exit(1); } } seed();