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/create-sample-client-data.js
const { PrismaClient } = require('@prisma/client');

const prisma = new PrismaClient();

async function createSampleClientData() {
  try {
    console.log('Creating sample client data...');

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

    if (!client) {
      console.error('No client user found. Please create a client user first.');
      return;
    }

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

    if (!lawyer) {
      console.error('No lawyer user found. Please create a lawyer user first.');
      return;
    }

    // Create sample cases
    const sampleCases = [
      {
        caseNumber: 'CASE-2025-001',
        title: 'Personal Injury - Car Accident',
        description: 'Client was involved in a car accident and seeking compensation for injuries and damages.',
        status: 'ACTIVE',
        priority: 'HIGH',
        clientId: client.id,
        lawyerId: lawyer.id
      },
      {
        caseNumber: 'CASE-2025-002',
        title: 'Employment Dispute - Wrongful Termination',
        description: 'Client was wrongfully terminated and seeking reinstatement and damages.',
        status: 'ACTIVE',
        priority: 'MEDIUM',
        clientId: client.id,
        lawyerId: lawyer.id
      },
      {
        caseNumber: 'CASE-2025-003',
        title: 'Contract Dispute - Business Partnership',
        description: 'Dispute over terms of business partnership agreement.',
        status: 'PENDING',
        priority: 'LOW',
        clientId: client.id,
        lawyerId: lawyer.id
      }
    ];

    const createdCases = [];
    for (const caseData of sampleCases) {
      const case_ = await prisma.legalCase.create({
        data: caseData
      });
      createdCases.push(case_);
      console.log(`Created case: ${case_.title}`);
    }

    // Create sample documents for each case
    const sampleDocuments = [
      {
        title: 'Medical Records',
        type: 'PDF',
        filePath: '/uploads/client-documents/sample-medical-records.pdf',
        fileSize: 2048576,
        uploadedBy: client.id,
        status: 'APPROVED'
      },
      {
        title: 'Police Report',
        type: 'PDF',
        filePath: '/uploads/client-documents/sample-police-report.pdf',
        fileSize: 1048576,
        uploadedBy: client.id,
        status: 'PENDING_REVIEW'
      },
      {
        title: 'Employment Contract',
        type: 'WORD',
        filePath: '/uploads/client-documents/sample-employment-contract.docx',
        fileSize: 512000,
        uploadedBy: client.id,
        status: 'APPROVED'
      },
      {
        title: 'Witness Statement',
        type: 'PDF',
        filePath: '/uploads/client-documents/sample-witness-statement.pdf',
        fileSize: 1536000,
        uploadedBy: client.id,
        status: 'PENDING_REVIEW'
      },
      {
        title: 'Partnership Agreement',
        type: 'PDF',
        filePath: '/uploads/client-documents/sample-partnership-agreement.pdf',
        fileSize: 3072000,
        uploadedBy: client.id,
        status: 'APPROVED'
      }
    ];

    for (let i = 0; i < sampleDocuments.length; i++) {
      const doc = sampleDocuments[i];
      const caseId = createdCases[Math.floor(i / 2)].id; // Distribute docs across cases
      
      const document = await prisma.document.create({
        data: {
          ...doc,
          caseId: caseId
        }
      });
      console.log(`Created document: ${document.title}`);
    }

    // Create sample payments
    const samplePayments = [
      {
        amount: 2500.00,
        status: 'PAID',
        dueDate: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago
        paidAt: new Date(Date.now() - 25 * 24 * 60 * 60 * 1000), // 25 days ago
        description: 'Initial Consultation and Case Review',
        type: 'CONSULTATION_FEE',
        caseId: createdCases[0].id
      },
      {
        amount: 1500.00,
        status: 'PENDING',
        dueDate: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7 days from now
        description: 'Document Preparation and Filing',
        type: 'LEGAL_FEES',
        caseId: createdCases[0].id
      },
      {
        amount: 3000.00,
        status: 'PAID',
        dueDate: new Date(Date.now() - 15 * 24 * 60 * 60 * 1000), // 15 days ago
        paidAt: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000), // 10 days ago
        description: 'Case Investigation and Research',
        type: 'LEGAL_FEES',
        caseId: createdCases[1].id
      },
      {
        amount: 2000.00,
        status: 'PENDING',
        dueDate: new Date(Date.now() + 14 * 24 * 60 * 60 * 1000), // 14 days from now
        description: 'Mediation and Settlement Negotiation',
        type: 'LEGAL_FEES',
        caseId: createdCases[1].id
      },
      {
        amount: 1000.00,
        status: 'PENDING',
        dueDate: new Date(Date.now() + 21 * 24 * 60 * 60 * 1000), // 21 days from now
        description: 'Contract Review and Analysis',
        type: 'CONSULTATION_FEE',
        caseId: createdCases[2].id
      }
    ];

    for (const paymentData of samplePayments) {
      const payment = await prisma.payment.create({
        data: paymentData
      });
      console.log(`Created payment: ${payment.description} - $${payment.amount}`);
    }

    // Create sample case updates
    const sampleUpdates = [
      {
        title: 'Case Filed Successfully',
        content: 'Your case has been officially filed with the court. Case number assigned: CASE-2025-001',
        type: 'STATUS_UPDATE',
        createdBy: lawyer.id,
        caseId: createdCases[0].id
      },
      {
        title: 'Medical Records Received',
        content: 'We have received your medical records and are currently reviewing them for your personal injury case.',
        type: 'DOCUMENT_UPDATE',
        createdBy: lawyer.id,
        caseId: createdCases[0].id
      },
      {
        title: 'Initial Consultation Scheduled',
        content: 'Your initial consultation has been scheduled for next week. Please bring all relevant documents.',
        type: 'APPOINTMENT',
        createdBy: lawyer.id,
        caseId: createdCases[1].id
      },
      {
        title: 'Witness Interview Completed',
        content: 'We have completed the witness interview. The testimony supports your case.',
        type: 'CASE_UPDATE',
        createdBy: lawyer.id,
        caseId: createdCases[0].id
      },
      {
        title: 'Settlement Offer Received',
        content: 'The opposing party has made a settlement offer. We will review and discuss with you.',
        type: 'SETTLEMENT',
        createdBy: lawyer.id,
        caseId: createdCases[1].id
      }
    ];

    for (const updateData of sampleUpdates) {
      const update = await prisma.caseUpdate.create({
        data: updateData
      });
      console.log(`Created case update: ${update.title}`);
    }

    // Create sample messages
    const sampleMessages = [
      {
        content: 'Hello, I have some questions about my case. When would be a good time to discuss?',
        senderId: client.id,
        receiverId: lawyer.id,
        caseId: createdCases[0].id,
        isRead: false
      },
      {
        content: 'Of course! I can call you tomorrow at 2 PM. Does that work for you?',
        senderId: lawyer.id,
        receiverId: client.id,
        caseId: createdCases[0].id,
        isRead: true
      },
      {
        content: 'Perfect, that works for me. I also wanted to ask about the medical records I uploaded.',
        senderId: client.id,
        receiverId: lawyer.id,
        caseId: createdCases[0].id,
        isRead: false
      },
      {
        content: 'I\'ve reviewed the medical records. They look comprehensive and will be very helpful for your case.',
        senderId: lawyer.id,
        receiverId: client.id,
        caseId: createdCases[0].id,
        isRead: true
      },
      {
        content: 'Great! When can I expect to hear about the next steps?',
        senderId: client.id,
        receiverId: lawyer.id,
        caseId: createdCases[0].id,
        isRead: false
      }
    ];

    for (const messageData of sampleMessages) {
      const message = await prisma.directMessage.create({
        data: messageData
      });
      console.log(`Created message: ${message.content.substring(0, 50)}...`);
    }

    console.log('Sample client data created successfully!');
  } catch (error) {
    console.error('Error creating sample client data:', error);
  } finally {
    await prisma.$disconnect();
  }
}

createSampleClientData(); 

CasperSecurity Mini