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

const prisma = new PrismaClient();

async function createTestCase() {
  try {
    console.log('๐Ÿ—๏ธ Creating test public case for live chat testing...');
    
    // First, get a user to be the creator
    const user = await prisma.user.findFirst({
      where: {
        role: 'SUPERADMIN'
      }
    });
    
    if (!user) {
      console.log('โŒ No SUPERADMIN user found. Please create a user first.');
      return;
    }
    
    // Create a test public case
    const testCase = await prisma.legalCase.create({
      data: {
        title: 'Test Public Case for Live Chat',
        description: 'This is a test case created specifically for testing the live chat functionality. Users can join this case and test real-time messaging features.',
        caseType: 'CIVIL',
        status: 'active',
        jurisdiction: 'Test Jurisdiction',
        priority: 'medium',
        isAcceptingApplications: true,
        isPublic: true, // This is crucial for the live chat to work
        category: 'Test Category',
        legalArea: 'Test Legal Area',
        urgencyLevel: 'NORMAL',
        riskLevel: 'MEDIUM',
        publicSummary: 'A public test case for live chat functionality testing.',
        tags: 'test,live-chat,public',
        requiredDocuments: JSON.stringify(['Test Document 1', 'Test Document 2']),
        eligibilityCriteria: 'Open to all users for testing purposes.',
        firmName: 'Test Law Firm',
        leadLawyerId: user.id,
        createdBy: user.id,
        viewCount: 0,
        supporterCount: 0,
        estimatedValue: 10000,
        expectedDuration: 30
      }
    });
    
    console.log('โœ… Test case created successfully!');
    console.log(`๐Ÿ“‹ Case ID: ${testCase.id}`);
    console.log(`๐Ÿ“ Title: ${testCase.title}`);
    console.log(`๐ŸŒ Public URL: /public/cases/${testCase.id}`);
    console.log(`๐Ÿ”— Full URL: https://localhost:3443/public/cases/${testCase.id}`);
    
    console.log('\n๐Ÿงช Testing Instructions:');
    console.log('1. Make sure the development server is running (npm run dev)');
    console.log('2. Visit the case URL above');
    console.log('3. Look for the floating chat button (bottom-right corner)');
    console.log('4. Click the button to open the live chat');
    console.log('5. Test sending messages and real-time features');
    console.log('6. Open multiple browser windows to test real-time messaging');
    
    console.log('\n๐Ÿ“Š Case Details:');
    console.log(`   - Status: ${testCase.status}`);
    console.log(`   - Public: ${testCase.isPublic}`);
    console.log(`   - Accepting Applications: ${testCase.isAcceptingApplications}`);
    console.log(`   - Created by: ${user.name} (${user.email})`);
    
    return testCase;
    
  } catch (error) {
    console.error('โŒ Error creating test case:', error);
    throw error;
  } finally {
    await prisma.$disconnect();
  }
}

// Run if this script is executed directly
if (require.main === module) {
  createTestCase()
    .then(() => {
      console.log('\n๐ŸŽ‰ Test case creation completed!');
      process.exit(0);
    })
    .catch((error) => {
      console.error('๐Ÿ’ฅ Failed to create test case:', error);
      process.exit(1);
    });
}

module.exports = { createTestCase }; 

CasperSecurity Mini