#!/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: `
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.
Medium: Digital Art
Year: 2024
Collection: Nature Series
A collection of abstract artworks featuring bold geometric patterns and contemporary design elements. These pieces explore the relationship between shape, color, and space.
These works are inspired by modernist movements and contemporary design trends.
`, category: "Abstract", imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg", isactive: true, }, { title: "Portrait Photography Collection", description: `This portrait series explores the depth of human emotion through carefully composed photographs. Each subject tells a unique story through their expression and body language.
Shot in various locations including urban settings, nature, and professional studios.
`, category: "Photography", imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg", isactive: true, }, { title: "Watercolor Botanical Illustrations", description: `A series of hand-painted watercolor illustrations featuring various botanical subjects. These pieces celebrate the intricate beauty of plants and flowers.
"Nature always wears the colors of the spirit." - Ralph Waldo Emerson
Each illustration is created using professional-grade watercolors on cold-press paper.
`, category: "Illustration", imageurl: "/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg", isactive: true, }, { title: "Urban Architecture Study", description: `An exploration of contemporary urban architecture through the lens of artistic photography and digital manipulation.
This project was completed over 6 months, documenting various cities and their unique architectural personalities.
Featured Cities: New York, Tokyo, Dubai, London
`, 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();