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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/private_html/scripts/create-sample-consultations.js
const { PrismaClient } = require('@prisma/client');
const bcrypt = require('bcryptjs');

const prisma = new PrismaClient();

async function createSampleConsultations() {
  try {
    console.log('Creating sample consultations...');

    // Get a lawyer user
    let lawyer = await prisma.user.findFirst({
      where: {
        role: 'LAWYER'
      }
    });

    if (!lawyer) {
      console.log('No lawyer found. Creating one...');
      const hashedPassword = await bcrypt.hash('password123', 10);
      lawyer = await prisma.user.create({
        data: {
          email: 'lawyer@example.com',
          name: 'John Smith',
          password: hashedPassword,
          role: 'LAWYER',
          isVerified: true,
          isProfilePublic: true,
          specialization: 'Criminal Law',
          barNumber: 'BAR123456',
          yearsOfExperience: 12,
          education: 'Harvard Law School',
          certifications: 'Certified Criminal Law Specialist',
          officeLocation: '123 Main St, Montreal, QC',
          workPhone: '+1-514-555-1234',
          linkedinUrl: 'https://linkedin.com/in/johnsmithlaw',
          websiteUrl: 'https://adw-lawyers.com/john-smith',
          hourlyRate: 250,
          proBono: false,
          boldnessRating: 4.7,
          transparencyRating: 4.9,
          winRate: 0.92,
          totalCases: 120,
          wonCases: 110,
          lostCases: 10,
          averageRating: 4.8,
          xpPoints: 5000,
          level: 7,
          currentStreak: 3,
          totalBadges: 5,
          reviewsWritten: 12,
          forumPosts: 8,
          helpedOthers: 15,
          observationHours: 120.5,
          reformProposals: 2,
          wisdomScore: 4.5,
          civicEngagement: 3.8,
          accountBalance: 12000.00,
          isPaymentVerified: true,
          donationTotal: 500.00,
          subscriptionTier: 'PREMIUM',
          theme: 'light',
          gender: 'male',
          phone: '+1-514-555-1234',
          address: '123 Main St, Montreal, QC',
          emergencyContact: 'Jane Smith',
          emergencyPhone: '+1-514-555-5678',
          dateOfBirth: new Date('1980-05-15'),
          occupation: 'Lawyer',
          language: 'en',
          notifications: true
        }
      });
      console.log('Created lawyer:', lawyer.email);
    }

    // Get a client user
    let client = await prisma.user.findFirst({
      where: {
        role: 'USER'
      }
    });

    if (!client) {
      console.log('No client found. Creating one...');
      const hashedPassword = await bcrypt.hash('password123', 10);
      client = await prisma.user.create({
        data: {
          email: 'client@example.com',
          name: 'Jane Doe',
          password: hashedPassword,
          role: 'USER',
          isVerified: true,
          isProfilePublic: false,
          occupation: 'Accountant',
          phone: '+1-438-555-9876',
          address: '456 Elm St, Montreal, QC',
          gender: 'female',
          dateOfBirth: new Date('1990-09-21'),
          language: 'en',
          notifications: true
        }
      });
      console.log('Created client:', client.email);
    }

    const lawyerId = lawyer.id;
    const clientId = client.id;

    // Create sample consultations
    const consultations = [
      {
        lawyerId,
        clientId,
        preferredDate: new Date(Date.now() + 24 * 60 * 60 * 1000), // Tomorrow
        preferredTime: '10:00',
        duration: 60,
        consultationType: 'CRIMINAL',
        status: 'PENDING',
        message: 'I need legal advice regarding a criminal case. Please help me understand my options.',
        hourlyRate: 200,
        totalAmount: 200
      },
      {
        lawyerId,
        clientId,
        preferredDate: new Date(Date.now() + 2 * 24 * 60 * 60 * 1000), // Day after tomorrow
        preferredTime: '14:00',
        duration: 90,
        consultationType: 'CIVIL',
        status: 'CONFIRMED',
        message: 'I have a civil dispute that I need help resolving. Looking forward to our meeting.',
        hourlyRate: 250,
        totalAmount: 375,
        meetingLink: 'https://zoom.us/j/123456789',
        meetingPlatform: 'ZOOM'
      },
      {
        lawyerId,
        clientId,
        preferredDate: new Date(Date.now() - 24 * 60 * 60 * 1000), // Yesterday
        preferredTime: '16:00',
        duration: 60,
        consultationType: 'FAMILY',
        status: 'COMPLETED',
        message: 'Family law consultation regarding divorce proceedings.',
        hourlyRate: 180,
        totalAmount: 180,
        notes: 'Client was very cooperative. Discussed settlement options.',
        lawyerNotes: 'Good potential for mediation. Follow up in 2 weeks.'
      },
      {
        lawyerId,
        clientId,
        preferredDate: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // Next week
        preferredTime: '11:30',
        duration: 45,
        consultationType: 'CORPORATE',
        status: 'PENDING',
        message: 'Need advice on corporate restructuring and legal compliance.',
        hourlyRate: 300,
        totalAmount: 225
      },
      {
        lawyerId,
        clientId,
        preferredDate: new Date(Date.now() + 3 * 24 * 60 * 60 * 1000), // In 3 days
        preferredTime: '09:00',
        duration: 120,
        consultationType: 'REAL_ESTATE',
        status: 'CONFIRMED',
        message: 'Real estate transaction consultation. Need help with contract review.',
        hourlyRate: 220,
        totalAmount: 440,
        meetingLink: 'https://teams.microsoft.com/l/meetup-join/123456789',
        meetingPlatform: 'TEAMS'
      }
    ];

    for (const consultationData of consultations) {
      const consultation = await prisma.consultationBooking.create({
        data: consultationData
      });
      console.log(`Created consultation: ${consultation.id} - ${consultation.consultationType}`);
    }

    console.log('Sample consultations created successfully!');
    console.log(`Created ${consultations.length} consultations`);

  } catch (error) {
    console.error('Error creating sample consultations:', error);
  } finally {
    await prisma.$disconnect();
  }
}

createSampleConsultations(); 

CasperSecurity Mini