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.quebec/private_html/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/scripts/seed-quebec-business-profiles.ts
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

// Quebec cities
const quebecCities = [
  'Montréal', 'Québec', 'Laval', 'Gatineau', 'Longueuil', 'Sherbrooke', 'Saguenay', 'Lévis', 'Trois-Rivières', 'Terrebonne',
  'Saint-Jean-sur-Richelieu', 'Repentigny', 'Brossard', 'Drummondville', 'Saint-Jérôme', 'Granby', 'Blainville', 'Saint-Hyacinthe',
  'Mirabel', 'Saint-Eustache', 'Victoriaville', 'Rimouski', 'Saint-Georges', 'Sorel-Tracy', 'Salaberry-de-Valleyfield',
  'Joliette', 'Saint-Bruno-de-Montarville', 'Boucherville', 'Vaudreuil-Dorion', 'Shawinigan', 'Saint-Constant', 'Mascouche',
  'Châteauguay', 'Saint-Augustin-de-Desmaures', 'Dollard-des-Ormeaux', 'Boisbriand', 'Saint-Lambert', 'Kirkland', 'Pointe-Claire',
  'Beaconsfield', 'Varennes', 'Sainte-Julie', 'Sainte-Thérèse', 'L\'Assomption', 'Beloeil', 'Candiac', 'Saint-Basile-le-Grand',
  'Sainte-Marthe-sur-le-Lac', 'L\'Ancienne-Lorette', 'Sainte-Catherine', 'L\'Île-Perrot', 'Sainte-Anne-des-Plaines', 'Lachute'
];

// French law firm name prefixes and suffixes
const firmPrefixes = [
  'Cabinet', 'Bureau', 'Étude', 'Société', 'Groupe', 'Alliance', 'Partners', 'Associés', 'Conseils', 'Services'
];

const firmSuffixes = [
  'Juridiques', 'Légal', 'Avocats', 'Conseillers', 'Experts', 'Spécialistes', 'Consultants', 'Associés', 'Partners', 'Groupe'
];

// French first names
const firstNames = [
  'Jean', 'Pierre', 'Marie', 'François', 'Claude', 'Michel', 'André', 'Robert', 'Paul', 'Jacques',
  'Luc', 'Marc', 'Denis', 'Gilles', 'Bernard', 'Marcel', 'Roger', 'Raymond', 'Gérard', 'Henri',
  'Suzanne', 'Monique', 'Louise', 'Nicole', 'Hélène', 'Francine', 'Diane', 'Jacqueline', 'Denise', 'Madeleine',
  'Sophie', 'Isabelle', 'Caroline', 'Valérie', 'Stéphanie', 'Catherine', 'Émilie', 'Julie', 'Audrey', 'Mélanie'
];

// French last names
const lastNames = [
  'Tremblay', 'Gagnon', 'Roy', 'Côté', 'Bouchard', 'Gauthier', 'Morin', 'Lavoie', 'Fortin', 'Gagné',
  'Ouellet', 'Pelletier', 'Bélanger', 'Lévesque', 'Bergeron', 'Leblanc', 'Paquette', 'Girard', 'Simard', 'Caron',
  'Dufour', 'Michaud', 'Arsenault', 'Rousseau', 'Lapointe', 'Larouche', 'Dubois', 'Lapierre', 'Blais', 'Boisvert',
  'Beaulieu', 'Couture', 'Deschênes', 'Dion', 'Dupuis', 'Fournier', 'Gaudreault', 'Grenier', 'Lachance', 'Landry'
];

// Legal practice areas
const practiceAreas = [
  'Droit civil', 'Droit commercial', 'Droit du travail', 'Droit de la famille', 'Droit immobilier', 'Droit fiscal',
  'Droit administratif', 'Droit constitutionnel', 'Droit criminel', 'Droit des assurances', 'Droit de la santé',
  'Droit de l\'environnement', 'Droit des technologies', 'Droit international', 'Droit maritime', 'Droit minier'
];

function generateRandomBusinessProfile() {
  const city = quebecCities[Math.floor(Math.random() * quebecCities.length)];
  const prefix = firmPrefixes[Math.floor(Math.random() * firmPrefixes.length)];
  const suffix = firmSuffixes[Math.floor(Math.random() * firmSuffixes.length)];
  const businessName = `${prefix} ${suffix} ${firstNames[Math.floor(Math.random() * firstNames.length)]} ${lastNames[Math.floor(Math.random() * lastNames.length)]}`;
  
  const practiceArea = practiceAreas[Math.floor(Math.random() * practiceAreas.length)];
  const yearsOfExperience = Math.floor(Math.random() * 30) + 5;
  const employeeCount = Math.floor(Math.random() * 20) + 1;
  const annualRevenue = Math.floor(Math.random() * 5000000) + 100000;

  return {
    businessName: businessName,
    businessType: 'Cabinet d\'avocats',
    industry: 'Services juridiques',
    description: `Cabinet d'avocats spécialisé en ${practiceArea}. Plus de ${yearsOfExperience} ans d'expérience au service de nos clients québécois.`,
    website: `www.${businessName.toLowerCase().replace(/[^a-z0-9]/g, '')}.ca`,
    phone: generateQuebecPhone(),
    email: generateEmail(businessName),
    address: `${Math.floor(Math.random() * 9999) + 1} Rue ${lastNames[Math.floor(Math.random() * lastNames.length)]}, ${city}, QC`,
    registrationNumber: `QC${Math.floor(Math.random() * 999999) + 100000}`,
    taxId: `BN${Math.floor(Math.random() * 999999999) + 100000000}`,
    employeeCount: employeeCount.toString(),
    annualRevenue: `$${annualRevenue.toLocaleString()}`,
    isPublic: Math.random() > 0.3, // 70% public
    isVerified: Math.random() > 0.4, // 60% verified
    verificationStatus: Math.random() > 0.3 ? 'APPROVED' : 'PENDING',
    verificationNote: Math.random() > 0.7 ? 'Profil vérifié par notre équipe' : null
  };
}

function generateQuebecPhone() {
  const areaCodes = ['514', '450', '819', '418', '581', '438', '873', '354', '579', '855'];
  const areaCode = areaCodes[Math.floor(Math.random() * areaCodes.length)];
  const number = Math.floor(Math.random() * 9999999) + 1000000;
  return `${areaCode}-${number.toString().slice(0, 3)}-${number.toString().slice(3)}`;
}

function generateEmail(businessName: string) {
  const cleanName = businessName.toLowerCase().replace(/[^a-z0-9]/g, '');
  const domains = ['gmail.com', 'outlook.com', 'hotmail.com', 'yahoo.com', 'cabinet.ca', 'avocat.ca'];
  const domain = domains[Math.floor(Math.random() * domains.length)];
  return `${cleanName}@${domain}`;
}

async function seedQuebecBusinessProfiles() {
  console.log('🌱 Seeding Quebec business profiles...');

  try {
    // Clear existing business profiles
    await prisma.businessProfile.deleteMany();

    const profiles = [];
    const createdUsers = [];

    // Create 50 users (lawyers) and their business profiles
    for (let i = 0; i < 50; i++) {
      const firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
      const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
      const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}${i}@cabinet.ca`;
      
      // Create user
      const user = await prisma.user.create({
        data: {
          email: email,
          name: `${firstName} ${lastName}`,
          role: 'LAWYER',
          password: '$2a$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewdBPj/RK.s5u.Ge', // demo123
          username: `${firstName.toLowerCase()}${lastName.toLowerCase()}${i}`,
          bio: `Avocat spécialisé avec plus de ${Math.floor(Math.random() * 25) + 5} ans d'expérience.`,
          phone: generateQuebecPhone(),
          address: `${Math.floor(Math.random() * 9999) + 1} Rue ${lastNames[Math.floor(Math.random() * lastNames.length)]}, ${quebecCities[Math.floor(Math.random() * quebecCities.length)]}, QC`,
          dateOfBirth: new Date(1970 + Math.floor(Math.random() * 40), Math.floor(Math.random() * 12), Math.floor(Math.random() * 28) + 1),
          gender: Math.random() > 0.5 ? 'MALE' : 'FEMALE',
          isVerified: Math.random() > 0.3,
          theme: 'light',
          language: 'fr',
          notifications: true,
          specialization: practiceAreas[Math.floor(Math.random() * practiceAreas.length)],
          yearsOfExperience: Math.floor(Math.random() * 30) + 5,
          hourlyRate: Math.floor(Math.random() * 200) + 100,
          winRate: Math.floor(Math.random() * 30) + 70,
          totalCases: Math.floor(Math.random() * 100) + 10,
          averageRating: Math.random() * 2 + 3,
          isProfilePublic: true
        }
      });

      createdUsers.push(user);

      // Generate business profile for this user
      const profile = generateRandomBusinessProfile();
      profiles.push({
        ...profile,
        ownerId: user.id,
        isPublic: true
      });
    }

    // Create business profiles
    for (const profile of profiles) {
      await prisma.businessProfile.create({
        data: profile
      });
    }

    console.log('✅ Quebec business profiles seeded successfully!');
    console.log(`Created ${profiles.length} users and business profiles from Quebec:`);
    profiles.forEach((profile, index) => {
      console.log(`  ${index + 1}. ${profile.businessName} - ${profile.address.split(',')[1]?.trim() || 'QC'}`);
    });

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

// Run the seed function
seedQuebecBusinessProfiles(); 

CasperSecurity Mini