![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/public_html/scripts/ |
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function createBusinessProfiles() {
try {
console.log('🏢 Creating Business Profiles...\n');
// Create business profile for Justin's firm (ADW Avocats)
const adwLawyers = await prisma.user.findMany({
where: {
lawFirm: {
name: 'ADW Avocats'
}
},
select: {
id: true,
name: true,
email: true,
role: true
}
});
if (adwLawyers.length > 0) {
console.log(`Found ${adwLawyers.length} lawyers from ADW Avocats`);
// Create business profile for Justin (the main lawyer)
const justin = adwLawyers.find(lawyer => lawyer.email === 'justin.wee@adwavocats.ca');
if (justin) {
const adwBusinessProfile = await prisma.businessProfile.create({
data: {
businessName: 'ADW Avocats',
businessType: 'Law Firm',
industry: 'Legal Services',
description: 'Specialized law firm focusing on class action lawsuits and civil rights cases, particularly the Bordeaux Prison class action. Our team of experienced lawyers provides comprehensive legal representation with a focus on justice and client advocacy.',
website: 'https://adwavocats.ca',
phone: '+1 (514) 555-0123',
email: 'contact@adwavocats.ca',
address: '1234 Rue Sherbrooke, Montréal, QC H3A 1A1',
employeeCount: '8-15',
annualRevenue: '$1M-$5M',
isPublic: true,
isVerified: true,
userId: justin.id
}
});
console.log(`✅ Created business profile for ADW Avocats (ID: ${adwBusinessProfile.id})`);
// Update Justin's profile to be public
await prisma.user.update({
where: { id: justin.id },
data: { isProfilePublic: true }
});
console.log('✅ Updated Justin\'s profile to be public');
}
}
// Create business profiles for some other prominent lawyers
const prominentLawyers = [
{
name: 'Marie Dubois',
email: 'lead.attorney@lmep.ca',
businessName: 'Liberté Même En Prison Legal Services',
businessType: 'Legal Services',
industry: 'Civil Rights Law',
description: 'Leading legal services firm specializing in civil rights cases and prison reform. We focus on protecting the rights of incarcerated individuals and their families.',
website: 'https://lmep.ca',
phone: '+1 (514) 555-0100',
email: 'contact@lmep.ca',
address: '5678 Boulevard Saint-Laurent, Montréal, QC H2T 1S1',
employeeCount: '5-10',
annualRevenue: '$500K-$1M'
},
{
name: 'David Justice',
email: 'david.justice@advocates.ca',
businessName: 'Justice & Associates',
businessType: 'Law Firm',
industry: 'Criminal Defense',
description: 'Experienced criminal defense firm with a track record of successful cases. We provide aggressive representation for clients facing serious charges.',
website: 'https://justiceadvocates.ca',
phone: '+1 (514) 555-0200',
email: 'contact@justiceadvocates.ca',
address: '9012 Rue de la Montagne, Montréal, QC H3G 1Z1',
employeeCount: '3-8',
annualRevenue: '$500K-$1M'
},
{
name: 'Marie Champion',
email: 'marie.champion@lawfirm.com',
businessName: 'Champion Legal Group',
businessType: 'Law Firm',
industry: 'Family Law',
description: 'Compassionate family law practice helping families navigate complex legal matters with care and expertise.',
website: 'https://championlegal.ca',
phone: '+1 (514) 555-0300',
email: 'contact@championlegal.ca',
address: '3456 Avenue du Parc, Montréal, QC H2V 4J1',
employeeCount: '2-5',
annualRevenue: '$250K-$500K'
}
];
for (const lawyerInfo of prominentLawyers) {
const lawyer = await prisma.user.findFirst({
where: {
email: lawyerInfo.email
}
});
if (lawyer) {
const businessProfile = await prisma.businessProfile.create({
data: {
businessName: lawyerInfo.businessName,
businessType: lawyerInfo.businessType,
industry: lawyerInfo.industry,
description: lawyerInfo.description,
website: lawyerInfo.website,
phone: lawyerInfo.phone,
email: lawyerInfo.email,
address: lawyerInfo.address,
employeeCount: lawyerInfo.employeeCount,
annualRevenue: lawyerInfo.annualRevenue,
isPublic: true,
isVerified: true,
userId: lawyer.id
}
});
console.log(`✅ Created business profile for ${lawyerInfo.businessName} (ID: ${businessProfile.id})`);
// Update lawyer's profile to be public
await prisma.user.update({
where: { id: lawyer.id },
data: { isProfilePublic: true }
});
console.log(`✅ Updated ${lawyer.name}'s profile to be public`);
} else {
console.log(`❌ Lawyer not found: ${lawyerInfo.name} (${lawyerInfo.email})`);
}
}
// Create some individual lawyer business profiles for top performers
const allLawyers = await prisma.user.findMany({
where: {
role: 'LAWYER',
isProfilePublic: true
},
include: {
businessProfiles: true
},
take: 10,
orderBy: {
totalCases: 'desc'
}
});
const lawyersWithoutProfiles = allLawyers.filter(lawyer => lawyer.businessProfiles.length === 0).slice(0, 5);
for (const lawyer of lawyersWithoutProfiles) {
const businessProfile = await prisma.businessProfile.create({
data: {
businessName: `${lawyer.name} Legal Services`,
businessType: 'Solo Practice',
industry: 'Legal Services',
description: `Experienced lawyer ${lawyer.name} providing professional legal services with a focus on client satisfaction and successful outcomes.`,
website: `https://${lawyer.name.toLowerCase().replace(' ', '')}.legal.ca`,
phone: `+1 (514) 555-${Math.floor(Math.random() * 9000) + 1000}`,
email: lawyer.email,
address: 'Montréal, QC',
employeeCount: '1-3',
annualRevenue: '$100K-$250K',
isPublic: true,
isVerified: true,
userId: lawyer.id
}
});
console.log(`✅ Created business profile for ${lawyer.name} (ID: ${businessProfile.id})`);
}
console.log('\n🎉 Business profiles creation completed!');
} catch (error) {
console.error('Error creating business profiles:', error);
} finally {
await prisma.$disconnect();
}
}
createBusinessProfiles();