Files
SkyArtShop/backend/quick-seed.js
Local Server 2a2a3d99e5 webupdate
2026-01-18 02:22:05 -06:00

236 lines
8.8 KiB
JavaScript

// Quick script to seed pagedata via the existing database module
const { query } = require("./config/database");
async function seedData() {
try {
// FAQ Page
const faqData = {
header: {
title: "Frequently Asked Questions",
subtitle: "Quick answers to common questions",
},
items: [
{
question: "How do I place an order?",
answer:
"Simply browse our shop, add items to your cart, and proceed to checkout. You can pay securely with credit card, debit card, or PayPal.",
},
{
question: "Do you offer custom artwork?",
answer:
"Yes! We offer custom commissions for paintings and artwork. Contact us with your vision and we'll provide a quote and timeline.",
},
{
question: "How long does shipping take?",
answer:
"Standard shipping takes 5-7 business days. Express shipping (2-3 days) and overnight options are available. Processing time is 1-2 business days.",
},
{
question: "What payment methods do you accept?",
answer:
"We accept all major credit cards (Visa, Mastercard, American Express, Discover), debit cards, and PayPal.",
},
{
question: "Can I cancel or modify my order?",
answer:
"You can cancel or modify your order within 24 hours of placing it. Contact us immediately at contact@skyartshop.com.",
},
{
question: "Do you ship internationally?",
answer:
"Yes, we ship to Canada, UK, and Australia. International shipping costs vary by location and are calculated at checkout.",
},
{
question: "What is your return policy?",
answer:
"We offer a 30-day return policy on most items. Items must be unused and in original packaging. See our Returns page for full details.",
},
{
question: "How can I track my order?",
answer:
"Once your order ships, you'll receive an email with tracking information. You can also check your order status in your account.",
},
],
};
await query(`UPDATE pages SET pagedata = $1 WHERE slug = 'faq'`, [
JSON.stringify(faqData),
]);
console.log("✓ FAQ pagedata seeded");
// Returns Page
const returnsData = {
header: {
title: "Returns & Refunds",
subtitle: "Our hassle-free return policy",
},
highlight:
"We want you to love your purchase! If you're not completely satisfied, we offer a 30-day return policy on most items.",
sections: [
{
title: "Return Eligibility",
content:
"To be eligible for a return, your item must meet the following conditions:",
listItems: [
"Returned within 30 days of delivery",
"Unused and in the same condition that you received it",
"In the original packaging with all tags attached",
"Accompanied by the original receipt or proof of purchase",
],
},
{
title: "Non-Returnable Items",
content: "The following items cannot be returned:",
listItems: [
"Personalized or custom-made items",
"Sale items marked as final sale",
"Gift cards or digital downloads",
"Items marked as non-returnable at checkout",
"Opened consumable items (inks, glues, adhesives)",
],
},
{
title: "How to Start a Return",
content: "To initiate a return, follow these simple steps:",
listItems: [
"Contact Us: Email support@skyartshop.com with your order number",
"Get Authorization: Receive your return authorization number",
"Pack & Ship: Securely package and ship your return",
"Get Refund: Receive your refund within 5-7 business days",
],
},
{
title: "Refund Process",
content:
"Once we receive your return, we will inspect the item and notify you. If approved, your refund will be processed within 2-3 business days.",
listItems: [],
},
],
};
await query(
`UPDATE pages SET pagedata = $1 WHERE slug = 'returns-refunds'`,
[JSON.stringify(returnsData)],
);
console.log("✓ Returns pagedata seeded");
// Shipping Page
const shippingData = {
header: {
title: "Shipping Information",
subtitle: "Fast, reliable delivery to your door",
},
sections: [
{
title: "Shipping Methods",
content: "We offer several shipping options to meet your needs:",
listItems: [
"Standard Shipping: 5-7 business days - FREE on orders over $50",
"Express Shipping: 2-3 business days - $12.99",
"Overnight Shipping: Next business day - $24.99",
],
},
{
title: "Processing Time",
content:
"Orders are processed within 1-2 business days. Orders placed after 2:00 PM EST will be processed the next business day.",
listItems: [],
},
{
title: "Delivery Areas",
content: "We currently ship to the following locations:",
listItems: [
"United States (all 50 states)",
"Canada",
"United Kingdom",
"Australia",
],
},
{
title: "Order Tracking",
content:
"Once your order ships, you'll receive an email with your tracking number. You can track your package through the carrier's website.",
listItems: [],
},
],
};
await query(`UPDATE pages SET pagedata = $1 WHERE slug = 'shipping-info'`, [
JSON.stringify(shippingData),
]);
console.log("✓ Shipping pagedata seeded");
// Privacy Page
const privacyData = {
header: { title: "Privacy Policy" },
lastUpdated: "January 2025",
sections: [
{
title: "Information We Collect",
content:
"We collect information you provide directly to us, such as when you create an account, make a purchase, subscribe to our newsletter, or contact us for support. This may include your name, email address, postal address, phone number, and payment information.",
},
{
title: "How We Use Your Information",
content:
"We use the information we collect to process transactions, send order confirmations and shipping updates, respond to your questions, send marketing communications (with your consent), and improve our website.",
},
{
title: "Information Sharing",
content:
"We do not sell, trade, or rent your personal information to third parties. We may share your information with service providers who assist us in operating our website and conducting our business.",
},
{
title: "Cookies and Tracking",
content:
"We use cookies and similar tracking technologies to track activity on our website. You can instruct your browser to refuse all cookies or to indicate when a cookie is being sent.",
},
{
title: "Data Security",
content:
"We implement security measures to maintain the safety of your personal information. All payment transactions are processed through secure, encrypted gateways.",
},
{
title: "Your Rights",
content:
"You have the right to access, update, or delete your personal information at any time. Contact us for assistance.",
},
{
title: "Contact Us",
content:
"If you have questions about this Privacy Policy, please contact us at privacy@skyartshop.com.",
},
],
};
await query(`UPDATE pages SET pagedata = $1 WHERE slug = 'privacy'`, [
JSON.stringify(privacyData),
]);
console.log("✓ Privacy pagedata seeded");
// Contact Page
const contactData = {
header: {
title: "Get in Touch",
subtitle:
"Have a question, suggestion, or just want to say hello? We'd love to hear from you!",
},
phone: "(555) 123-4567",
email: "hello@skyartshop.com",
address: "123 Creative Lane, Artville, CA 90210",
businessHours: [
{ day: "Monday - Friday", hours: "9:00 AM - 5:00 PM EST" },
{ day: "Saturday - Sunday", hours: "Closed" },
],
};
await query(`UPDATE pages SET pagedata = $1 WHERE slug = 'contact'`, [
JSON.stringify(contactData),
]);
console.log("✓ Contact pagedata seeded");
console.log("\n✅ All pagedata seeded successfully!");
process.exit(0);
} catch (err) {
console.error("Error:", err);
process.exit(1);
}
}
seedData();