feat: Implement CMS module with API endpoints, data model, and initial seeding for landing page content.
This commit is contained in:
182
prisma/seed.ts
182
prisma/seed.ts
@@ -1353,6 +1353,186 @@ async function main() {
|
||||
console.log(' ───────────────────────────────\n');
|
||||
}
|
||||
|
||||
// =============================================
|
||||
// Seed CMS Content (Landing Page)
|
||||
// =============================================
|
||||
console.log('📄 Seeding CMS Content...');
|
||||
|
||||
const cmsDefaults = [
|
||||
{
|
||||
pageSlug: 'landing',
|
||||
sectionKey: 'hero',
|
||||
content: {
|
||||
headline: '"Discover verified, top-rated real estate professionals to guide your buying, selling, or investing journey."',
|
||||
description: 'Discover verified, top-rated real estate professionals',
|
||||
ctaButtonText: 'See All Agents',
|
||||
helperText: 'Connect with trusted local agents to explore homes, compare options, and make smarter decisions.',
|
||||
},
|
||||
},
|
||||
{
|
||||
pageSlug: 'landing',
|
||||
sectionKey: 'features',
|
||||
content: {
|
||||
title: 'Find Trusted Real Estate Professionals On Demand',
|
||||
subtitle: 'Quickly connect with the right agents exactly when you need them.',
|
||||
features: [
|
||||
{
|
||||
iconPath: '/assets/icons/hourglass-icon.svg',
|
||||
title: 'Hire Quickly',
|
||||
description: 'Connect with experienced local real estate agents who match your needs and preferences. Our simple process helps you get started quickly and move forward without delays or unnecessary complexity.',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/verified-badge-icon.svg',
|
||||
title: 'Verified Agents',
|
||||
description: 'All agents are carefully identity-verified and background-checked to ensure trust and safety. You can confidently work with professionals who meet quality and reliability standards.',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/star-orange-icon.svg',
|
||||
title: 'Top Rated',
|
||||
description: 'Work with highly rated agents known for strong expertise and positive client feedback. Their consistent performance helps you make informed and confident property decisions.',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/trusted-people-icon.svg',
|
||||
title: 'Trusted by Thousands',
|
||||
description: 'Thousands of buyers, sellers, and renters trust our platform to find reliable agents. Our professionals help people navigate property journeys with confidence and ease.',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
pageSlug: 'landing',
|
||||
sectionKey: 'topProfessionals',
|
||||
content: {
|
||||
title: '"Meet top real estate professionals"',
|
||||
ctaText: 'Discover 5,000+ Top Real Estate Agents in Our Network.',
|
||||
ctaButtonText: 'Browse Experts',
|
||||
agents: [
|
||||
{
|
||||
name: 'Arjun Mehta',
|
||||
subtitle: '(Residential Property Expert)',
|
||||
location: 'San Francisco, CA',
|
||||
experience: '10+ years in the real estate industry.',
|
||||
expertise: ['Residential', 'Rental', 'Commercial', 'Inspection', 'Land', 'Rental'],
|
||||
imageUrl: '/assets/images/professional-1.jpg',
|
||||
},
|
||||
{
|
||||
name: 'Arjun Mehta',
|
||||
subtitle: '(Residential Property Expert)',
|
||||
location: 'San Francisco, CA',
|
||||
experience: '10+ years in the real estate industry.',
|
||||
expertise: ['Residential', 'Rental', 'Commercial', 'Inspection', 'Land', 'Rental'],
|
||||
imageUrl: '/assets/images/professional-2.jpg',
|
||||
},
|
||||
{
|
||||
name: 'Arjun Mehta',
|
||||
subtitle: '(Residential Property Expert)',
|
||||
location: 'San Francisco, CA',
|
||||
experience: '10+ years in the real estate industry.',
|
||||
expertise: ['Residential', 'Rental', 'Commercial', 'Inspection', 'Land', 'Rental'],
|
||||
imageUrl: '/assets/images/professional-3.jpg',
|
||||
},
|
||||
],
|
||||
lenders: [
|
||||
{
|
||||
name: 'Sarah Johnson',
|
||||
subtitle: '(Mortgage Specialist)',
|
||||
location: 'Los Angeles, CA',
|
||||
experience: '10+ years in mortgage lending.',
|
||||
expertise: ['FHA Loans', 'Conventional', 'VA Loans', 'Refinancing', 'Jumbo'],
|
||||
imageUrl: '/assets/images/professional-1.jpg',
|
||||
},
|
||||
{
|
||||
name: 'Michael Chen',
|
||||
subtitle: '(Senior Loan Officer)',
|
||||
location: 'Seattle, WA',
|
||||
experience: '7+ years in lending.',
|
||||
expertise: ['Jumbo Loans', 'Refinancing', 'Investment', 'First-time', 'USDA'],
|
||||
imageUrl: '/assets/images/professional-2.jpg',
|
||||
},
|
||||
{
|
||||
name: 'Emily Davis',
|
||||
subtitle: '(Home Loan Advisor)',
|
||||
location: 'Austin, TX',
|
||||
experience: '5+ years in mortgage industry.',
|
||||
expertise: ['First-time Buyers', 'FHA', 'USDA Loans', 'VA Loans', 'Conventional'],
|
||||
imageUrl: '/assets/images/professional-3.jpg',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
pageSlug: 'landing',
|
||||
sectionKey: 'testimonials',
|
||||
content: {
|
||||
title: "Our Clients' Trust Is Our Foundation",
|
||||
subtitle: 'We help buyers, sellers, and investors close successful real estate deals with confidence in every transaction.',
|
||||
ratingInfo: 'Clients rate our real estate services 4.9 out of 5 on average, based on recent client reviews.',
|
||||
stats: [
|
||||
{
|
||||
iconPath: '/assets/icons/cities-icon.svg',
|
||||
boldText: '25+ Cities &',
|
||||
normalText: 'neighborhoods served',
|
||||
},
|
||||
{
|
||||
iconPath: '/assets/icons/properties-icon.svg',
|
||||
boldText: '1,000+ Properties',
|
||||
normalText: 'bought and sold for our clients.',
|
||||
},
|
||||
],
|
||||
testimonials: [
|
||||
{
|
||||
rating: 5,
|
||||
title: 'I have been working with Lorem ..',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean commodo ligula eget dolor. Sed dignissim, nisl eget tincidunt vulputate, lacus justo bibendum ipsum, vitae tempus risus lorem at nunc. Integer sed arcu vitae risus feugiat vehicula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
|
||||
author: 'Conor Kenney',
|
||||
role: 'Chief Operations Officer',
|
||||
},
|
||||
{
|
||||
rating: 5,
|
||||
title: 'I have been working with Lorem ..',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean commodo ligula eget dolor. Sed dignissim, nisl eget tincidunt vulputate, lacus justo bibendum ipsum, vitae tempus risus lorem at nunc. Integer sed arcu vitae risus feugiat vehicula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
|
||||
author: 'Conor Kenney',
|
||||
role: 'Chief Operations Officer',
|
||||
},
|
||||
{
|
||||
rating: 5,
|
||||
title: 'I have been working with Lorem ..',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean commodo ligula eget dolor. Sed dignissim, nisl eget tincidunt vulputate, lacus justo bibendum ipsum, vitae tempus risus lorem at nunc. Integer sed arcu vitae risus feugiat vehicula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
|
||||
author: 'Conor Kenney',
|
||||
role: 'Chief Operations Officer',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
for (const cms of cmsDefaults) {
|
||||
const existing = await prisma.cmsContent.findUnique({
|
||||
where: {
|
||||
pageSlug_sectionKey: {
|
||||
pageSlug: cms.pageSlug,
|
||||
sectionKey: cms.sectionKey,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
console.log(` ⚠️ CMS content "${cms.pageSlug}/${cms.sectionKey}" already exists`);
|
||||
} else {
|
||||
await prisma.cmsContent.create({
|
||||
data: {
|
||||
pageSlug: cms.pageSlug,
|
||||
sectionKey: cms.sectionKey,
|
||||
content: cms.content,
|
||||
isPublished: true,
|
||||
},
|
||||
});
|
||||
console.log(` ✅ Created CMS content: ${cms.pageSlug}/${cms.sectionKey}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
// =============================================
|
||||
// Summary
|
||||
// =============================================
|
||||
@@ -1363,6 +1543,7 @@ async function main() {
|
||||
const fieldCount = await prisma.profileField.count();
|
||||
const systemSectionCount = await prisma.profileSection.count({ where: { isSystem: true } });
|
||||
const agentTypeSectionCount = await prisma.agentTypeSection.count();
|
||||
const cmsContentCount = await prisma.cmsContent.count();
|
||||
|
||||
console.log('📊 Database Summary:');
|
||||
console.log(` Total Users: ${userCount}`);
|
||||
@@ -1371,6 +1552,7 @@ async function main() {
|
||||
console.log(` Profile Sections: ${sectionCount} (${systemSectionCount} system)`);
|
||||
console.log(` Profile Fields: ${fieldCount}`);
|
||||
console.log(` Section Assignments: ${agentTypeSectionCount}`);
|
||||
console.log(` CMS Content: ${cmsContentCount}`);
|
||||
console.log('\n🌱 Seeding completed!\n');
|
||||
|
||||
await prisma.$disconnect();
|
||||
|
||||
Reference in New Issue
Block a user