148 lines
5.6 KiB
JavaScript
Executable File
148 lines
5.6 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Add Test Portfolio Projects
|
|
* This script adds sample portfolio projects to the database
|
|
*/
|
|
|
|
const { query } = require("./config/database");
|
|
|
|
async function addTestPortfolioProjects() {
|
|
console.log("🎨 Adding test portfolio projects...\n");
|
|
|
|
const testProjects = [
|
|
{
|
|
title: "Sunset Landscape Series",
|
|
description: `<h2>A Beautiful Collection of Sunset Landscapes</h2>
|
|
<p>This series captures the breathtaking beauty of sunsets across different landscapes. Each piece showcases unique color palettes ranging from warm oranges and reds to cool purples and blues.</p>
|
|
<h3>Key Features:</h3>
|
|
<ul>
|
|
<li>High-resolution digital paintings</li>
|
|
<li>Vibrant color gradients</li>
|
|
<li>Emotional depth and atmosphere</li>
|
|
<li>Available in multiple sizes</li>
|
|
</ul>
|
|
<p><strong>Medium:</strong> Digital Art<br>
|
|
<strong>Year:</strong> 2024<br>
|
|
<strong>Collection:</strong> Nature Series</p>`,
|
|
category: "Digital Art",
|
|
imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg",
|
|
isactive: true,
|
|
},
|
|
{
|
|
title: "Abstract Geometric Patterns",
|
|
description: `<h2>Modern Abstract Compositions</h2>
|
|
<p>A collection of abstract artworks featuring <strong>bold geometric patterns</strong> and contemporary design elements. These pieces explore the relationship between shape, color, and space.</p>
|
|
<h3>Artistic Approach:</h3>
|
|
<ol>
|
|
<li>Started with basic geometric shapes</li>
|
|
<li>Layered multiple patterns and textures</li>
|
|
<li>Applied vibrant color combinations</li>
|
|
<li>Refined composition for visual balance</li>
|
|
</ol>
|
|
<p><em>These works are inspired by modernist movements and contemporary design trends.</em></p>`,
|
|
category: "Abstract",
|
|
imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg",
|
|
isactive: true,
|
|
},
|
|
{
|
|
title: "Portrait Photography Collection",
|
|
description: `<h2>Capturing Human Emotion</h2>
|
|
<p>This portrait series explores the <strong>depth of human emotion</strong> through carefully composed photographs. Each subject tells a unique story through their expression and body language.</p>
|
|
<h3>Technical Details:</h3>
|
|
<ul>
|
|
<li><strong>Camera:</strong> Canon EOS R5</li>
|
|
<li><strong>Lens:</strong> 85mm f/1.4</li>
|
|
<li><strong>Lighting:</strong> Natural and studio</li>
|
|
<li><strong>Processing:</strong> Adobe Lightroom & Photoshop</li>
|
|
</ul>
|
|
<p>Shot in various locations including urban settings, nature, and professional studios.</p>`,
|
|
category: "Photography",
|
|
imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg",
|
|
isactive: true,
|
|
},
|
|
{
|
|
title: "Watercolor Botanical Illustrations",
|
|
description: `<h2>Delicate Flora Studies</h2>
|
|
<p>A series of <em>hand-painted watercolor illustrations</em> featuring various botanical subjects. These pieces celebrate the intricate beauty of plants and flowers.</p>
|
|
<h3>Collection Includes:</h3>
|
|
<ul>
|
|
<li>Wildflowers and garden blooms</li>
|
|
<li>Tropical plants and leaves</li>
|
|
<li>Herbs and medicinal plants</li>
|
|
<li>Seasonal botanical studies</li>
|
|
</ul>
|
|
<blockquote>
|
|
<p>"Nature always wears the colors of the spirit." - Ralph Waldo Emerson</p>
|
|
</blockquote>
|
|
<p>Each illustration is created using professional-grade watercolors on cold-press paper.</p>`,
|
|
category: "Illustration",
|
|
imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg",
|
|
isactive: true,
|
|
},
|
|
{
|
|
title: "Urban Architecture Study",
|
|
description: `<h2>Modern Cityscapes and Structures</h2>
|
|
<p>An exploration of <strong>contemporary urban architecture</strong> through the lens of artistic photography and digital manipulation.</p>
|
|
<h3>Focus Areas:</h3>
|
|
<ul>
|
|
<li>Geometric building facades</li>
|
|
<li>Glass and steel structures</li>
|
|
<li>Reflections and symmetry</li>
|
|
<li>Night photography and lighting</li>
|
|
</ul>
|
|
<p>This project was completed over 6 months, documenting various cities and their unique architectural personalities.</p>
|
|
<p><strong>Featured Cities:</strong> New York, Tokyo, Dubai, London</p>`,
|
|
category: "Photography",
|
|
imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg",
|
|
isactive: false,
|
|
},
|
|
];
|
|
|
|
try {
|
|
// Get next ID - portfolioprojects.id appears to be text/varchar type
|
|
const maxIdResult = await query(
|
|
"SELECT MAX(CAST(id AS INTEGER)) as max_id FROM portfolioprojects WHERE id ~ '^[0-9]+$'"
|
|
);
|
|
let nextId = (maxIdResult.rows[0].max_id || 0) + 1;
|
|
|
|
for (const project of testProjects) {
|
|
const result = await query(
|
|
`INSERT INTO portfolioprojects (id, title, description, category, imageurl, isactive, createdat, updatedat)
|
|
VALUES ($1, $2, $3, $4, $5, $6, NOW(), NOW())
|
|
RETURNING id, title`,
|
|
[
|
|
nextId.toString(),
|
|
project.title,
|
|
project.description,
|
|
project.category,
|
|
project.imageurl,
|
|
project.isactive,
|
|
]
|
|
);
|
|
|
|
console.log(
|
|
`✓ Created: "${result.rows[0].title}" (ID: ${result.rows[0].id})`
|
|
);
|
|
nextId++;
|
|
}
|
|
|
|
console.log(
|
|
`\n🎉 Successfully added ${testProjects.length} test portfolio projects!`
|
|
);
|
|
console.log("\n📝 Note: All projects use a placeholder image. You can:");
|
|
console.log(" 1. Go to /admin/portfolio.html");
|
|
console.log(" 2. Edit each project");
|
|
console.log(" 3. Select real images from your media library");
|
|
console.log("\n✅ Portfolio management is now ready to use!\n");
|
|
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error("❌ Error adding test projects:", error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the function
|
|
addTestPortfolioProjects();
|