From a435a3d25ecde8d90f10620b543f85d158acb9fc Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sat, 11 Apr 2026 21:44:38 +0530 Subject: [PATCH] feat: update testimonials content and implement automatic CMS record updates during seeding --- prisma/seed.ts | 50 +++++++++++++-------- prisma/update-testimonials.ts | 84 +++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 prisma/update-testimonials.ts diff --git a/prisma/seed.ts b/prisma/seed.ts index 9fd81b0..a28b522 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -1490,42 +1490,42 @@ async function main() { 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.', + title: 'Consumer Protection is Our Foundation', + subtitle: "Buying or selling your home is one of the largest decisions you will make in your life. Don't let yourself be chased by salesmen. Find the service provider that matches your unique needs.", 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', + boldText: '3 states', + normalText: 'and counting', }, { iconPath: '/assets/icons/properties-icon.svg', - boldText: '1,000+ Properties', - normalText: 'bought and sold for our clients.', + boldText: 'Hundreds of', + normalText: 'Professionals', }, ], 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', + title: 'No Longer Blood in the Water', + content: 'Using other sites to find a realtor ended with my phone ringing constantly. My number was sold off to multiple lists and it was so overwhelming. RE-Quest gave me confidence that my information was protected and I decided who I was in contact with.', + author: 'Alice T.', + role: '', }, { 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', + title: 'Finding Someone Who Worked with Me', + content: 'RE-Quest let me narrow down my search terms, so I knew before I called that they had experience with the loan program I needed. I loved the in-app chat feature to talk to my short list before committing to a phone call.', + author: 'Kevin R.', + role: '', }, { 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', + title: '', + content: 'The search terms on RE-Quest allowed me to show off my expertise as an agent. Now when leads reach out to me, they already have an idea of what kind of agent I am. Instant connection!', + author: 'Riley S.', + role: '', }, ], }, @@ -1569,7 +1569,19 @@ async function main() { }); if (existing) { - console.log(` ⚠️ CMS content "${cms.pageSlug}/${cms.sectionKey}" already exists`); + await prisma.cmsContent.update({ + where: { + pageSlug_sectionKey: { + pageSlug: cms.pageSlug, + sectionKey: cms.sectionKey, + }, + }, + data: { + content: cms.content, + isPublished: true, + }, + }); + console.log(` 🔄 Updated CMS content: ${cms.pageSlug}/${cms.sectionKey}`); } else { await prisma.cmsContent.create({ data: { diff --git a/prisma/update-testimonials.ts b/prisma/update-testimonials.ts new file mode 100644 index 0000000..7ab56d9 --- /dev/null +++ b/prisma/update-testimonials.ts @@ -0,0 +1,84 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +const testimonialsContent = { + title: 'Consumer Protection is Our Foundation', + subtitle: + "Buying or selling your home is one of the largest decisions you will make in your life. Don't let yourself be chased by salesmen. Find the service provider that matches your unique needs.", + 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: '3 states', + normalText: 'and counting', + }, + { + iconPath: '/assets/icons/properties-icon.svg', + boldText: 'Hundreds of', + normalText: 'Professionals', + }, + ], + testimonials: [ + { + rating: 5, + title: 'No Longer Blood in the Water', + content: + 'Using other sites to find a realtor ended with my phone ringing constantly. My number was sold off to multiple lists and it was so overwhelming. RE-Quest gave me confidence that my information was protected and I decided who I was in contact with.', + author: 'Alice T.', + role: '', + }, + { + rating: 5, + title: 'Finding Someone Who Worked with Me', + content: + 'RE-Quest let me narrow down my search terms, so I knew before I called that they had experience with the loan program I needed. I loved the in-app chat feature to talk to my short list before committing to a phone call.', + author: 'Kevin R.', + role: '', + }, + { + rating: 5, + title: '', + content: + 'The search terms on RE-Quest allowed me to show off my expertise as an agent. Now when leads reach out to me, they already have an idea of what kind of agent I am. Instant connection!', + author: 'Riley S.', + role: '', + }, + ], +}; + +async function main() { + const result = await prisma.cmsContent.upsert({ + where: { + pageSlug_sectionKey: { + pageSlug: 'landing', + sectionKey: 'testimonials', + }, + }, + update: { + content: testimonialsContent, + isPublished: true, + }, + create: { + pageSlug: 'landing', + sectionKey: 'testimonials', + content: testimonialsContent, + isPublished: true, + }, + }); + + console.log('✅ Testimonials CMS content updated'); + console.log(` id: ${result.id}`); + console.log(` pageSlug: ${result.pageSlug}`); + console.log(` sectionKey: ${result.sectionKey}`); +} + +main() + .catch((e) => { + console.error('❌ Failed to update testimonials:', e); + process.exit(1); + }) + .finally(async () => { + await prisma.$disconnect(); + });