T.ME/BIBIL_0DAY
CasperSecurity


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/public_html/scripts/seed-business-profiles.js
const { PrismaClient } = require('@prisma/client');

const prisma = new PrismaClient();

async function seedBusinessProfiles() {
  try {
    console.log('🏢 Seeding Business Profiles...\n');

    // Find Justin Wee (ADW Avocats owner)
    const justin = await prisma.user.findUnique({
      where: { email: 'justin.wee@adwavocats.ca' }
    });

    if (!justin) {
      console.log('❌ Justin Wee not found, creating ADW Avocats business profile...');
      return;
    }

    // Create ADW Avocats business profile
    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,
        ownerId: justin.id
      }
    });

    console.log(`✅ Created ADW Avocats business profile (ID: ${adwBusinessProfile.id})`);

    // Find ADW Avocats team members
    const adwTeamEmails = [
      'audrey.labrecque@adwavocats.ca',
      'marie-claude.tremblay@adwavocats.ca',
      'david.chen@adwavocats.ca',
      'sophie.dubois@adwavocats.ca',
      'marc-andre.bouchard@adwavocats.ca',
      'isabella.rodriguez@adwavocats.ca',
      'thomas.leblanc@adwavocats.ca'
    ];

    const adwTeamMembers = await prisma.user.findMany({
      where: {
        email: { in: adwTeamEmails }
      }
    });

    // Add team members to ADW Avocats
    if (adwTeamMembers.length > 0) {
      await prisma.businessProfile.update({
        where: { id: adwBusinessProfile.id },
        data: {
          members: {
            connect: adwTeamMembers.map(member => ({ id: member.id }))
          }
        }
      });

      console.log(`✅ Added ${adwTeamMembers.length} team members to ADW Avocats`);
    }

    // Create additional business profiles for other lawyers
    const additionalBusinesses = [
      {
        ownerEmail: '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'
      },
      {
        ownerEmail: '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'
      },
      {
        ownerEmail: '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 businessInfo of additionalBusinesses) {
      const owner = await prisma.user.findUnique({
        where: { email: businessInfo.ownerEmail }
      });

      if (owner) {
        const businessProfile = await prisma.businessProfile.create({
          data: {
            businessName: businessInfo.businessName,
            businessType: businessInfo.businessType,
            industry: businessInfo.industry,
            description: businessInfo.description,
            website: businessInfo.website,
            phone: businessInfo.phone,
            email: businessInfo.email,
            address: businessInfo.address,
            employeeCount: businessInfo.employeeCount,
            annualRevenue: businessInfo.annualRevenue,
            isPublic: true,
            isVerified: true,
            ownerId: owner.id
          }
        });

        console.log(`✅ Created ${businessInfo.businessName} business profile (ID: ${businessProfile.id})`);

        // Update owner's profile to be public
        await prisma.user.update({
          where: { id: owner.id },
          data: { isProfilePublic: true }
        });
      } else {
        console.log(`❌ Owner not found: ${businessInfo.ownerEmail}`);
      }
    }

    // Create some individual lawyer business profiles
    const topLawyers = await prisma.user.findMany({
      where: {
        role: 'LAWYER',
        isProfilePublic: true,
        ownedBusinessProfiles: {
          none: {}
        }
      },
      take: 5,
      orderBy: {
        totalCases: 'desc'
      }
    });

    for (const lawyer of topLawyers) {
      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,
          ownerId: lawyer.id
        }
      });

      console.log(`✅ Created business profile for ${lawyer.name} (ID: ${businessProfile.id})`);
    }

    console.log('\n🎉 Business profiles seeding completed!');

    // Display summary
    const totalBusinesses = await prisma.businessProfile.count();
    const publicBusinesses = await prisma.businessProfile.count({
      where: { isPublic: true }
    });

    console.log(`\n📊 Summary:`);
    console.log(`   Total Business Profiles: ${totalBusinesses}`);
    console.log(`   Public Business Profiles: ${publicBusinesses}`);

  } catch (error) {
    console.error('Error seeding business profiles:', error);
  } finally {
    await prisma.$disconnect();
  }
}

seedBusinessProfiles(); 

CasperSecurity Mini