const db = require("./config/database"); async function addCustomerServicePages() { try { console.log("Adding customer service pages to database...\n"); // Helper function to insert or update page async function upsertPage(slug, title, html, metatitle, metadescription) { const existing = await db.query("SELECT id FROM pages WHERE slug = $1", [ slug, ]); if (existing.rows.length > 0) { await db.query( ` UPDATE pages SET pagecontent = $1, content = $1, title = $2, metatitle = $3, metadescription = $4, updatedat = NOW() WHERE slug = $5 `, [html, title, metatitle, metadescription, slug] ); console.log(`✓ ${title} page updated`); } else { await db.query( ` INSERT INTO pages (id, slug, title, content, pagecontent, metatitle, metadescription, ispublished, isactive, createdat, updatedat) VALUES (gen_random_uuid()::text, $1, $2, $3, $3, $4, $5, true, true, NOW(), NOW()) `, [slug, title, html, metatitle, metadescription] ); console.log(`✓ ${title} page added`); } } // 1. Shipping Info Page const shippingHTML = `

Shipping Information

Everything you need to know about our shipping policies and delivery

Shipping Methods

Delivery Areas

We currently ship to all 50 states in the United States. International shipping is available to Canada, UK, and Australia. Additional fees may apply for international orders.

Processing Time

Orders are typically processed within 1-2 business days. You will receive a tracking number via email once your order ships. Custom or personalized items may require additional processing time (3-5 business days).

`; await upsertPage( "shipping-info", "Shipping Info", shippingHTML, "Shipping Information - Sky Art Shop", "Learn about our shipping methods, delivery times, and policies." ); // 2. Returns Page const returnsHTML = `

Returns & Refunds

Our hassle-free return policy to ensure your satisfaction

Return Policy

We accept returns within 30 days of purchase. Items must be in original condition, unused, and in original packaging.

Refund Process

Once we receive your return, we will inspect the item and process your refund within 5-7 business days. Refunds will be issued to the original payment method. Shipping costs are non-refundable unless the return is due to our error.

How to Return

  1. Contact us at returns@skyartshop.com to initiate a return
  2. Pack the item securely in original packaging
  3. Ship to the address provided in our return confirmation email
  4. We recommend using a trackable shipping method
`; await upsertPage( "returns", "Returns", returnsHTML, "Returns & Refunds - Sky Art Shop", "Our return policy and refund process explained." ); // 3. FAQ Page const faqHTML = `

Frequently Asked Questions

Find answers to common questions about our products and services

How do I place an order?

Simply browse our shop, add items to your cart, and proceed to checkout. You can pay securely with credit card, debit card, or PayPal.

Do you offer custom artwork?

Yes! We offer custom commissions for paintings and artwork. Contact us with your vision and we'll provide a quote and timeline.

How long does shipping take?

Standard shipping takes 5-7 business days. Express shipping (2-3 days) and overnight options are available. Processing time is 1-2 business days.

What payment methods do you accept?

We accept all major credit cards (Visa, Mastercard, American Express, Discover), debit cards, and PayPal.

Can I cancel or modify my order?

You can cancel or modify your order within 24 hours of placing it. Contact us immediately at contact@skyartshop.com.

Do you ship internationally?

Yes, we ship to Canada, UK, and Australia. International shipping costs vary by location and are calculated at checkout.

`; await upsertPage( "faq", "FAQ", faqHTML, "Frequently Asked Questions - Sky Art Shop", "Answers to common questions about orders, shipping, and our services." ); // 4. Privacy Policy Page const privacyHTML = `

Privacy Policy

How we collect, use, and protect your information

Information We Collect

We collect information you provide directly to us, including:

How We Use Your Information

We use the information we collect to:

Information Sharing

We do not sell your personal information. We may share your information with:

Data Security

We implement appropriate security measures to protect your personal information. All payment information is encrypted using SSL technology. However, no method of transmission over the internet is 100% secure.

Your Rights

You have the right to:

Contact Us

If you have questions about this Privacy Policy, please contact us at:

Email: privacy@skyartshop.com
Phone: +1 (555) 123-4567
Last Updated: January 1, 2026

`; await upsertPage( "privacy", "Privacy Policy", privacyHTML, "Privacy Policy - Sky Art Shop", "Our privacy policy and how we protect your information." ); console.log("\n✅ All customer service pages added successfully!"); console.log("\nPages available at:"); console.log(" - http://localhost:5000/shipping-info.html"); console.log(" - http://localhost:5000/returns.html"); console.log(" - http://localhost:5000/faq.html"); console.log(" - http://localhost:5000/privacy.html"); console.log( "\nThese pages are now editable in the admin panel under Custom Pages!" ); process.exit(0); } catch (error) { console.error("Error adding customer service pages:", error); process.exit(1); } } addCustomerServicePages();