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/test-relationships.ts
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

async function testRelationships() {
  console.log('šŸ” Testing Client-Lawyer Relationship System...\n');

  try {
    // Get all lawyers
    const lawyers = await prisma.user.findMany({
      where: {
        OR: [
          { role: 'LAWYER' },
          { role: 'ADMIN' }
        ]
      },
      select: {
        id: true,
        name: true,
        email: true,
        role: true
      }
    });

    console.log(`šŸ‘Øā€āš–ļø Found ${lawyers.length} lawyers:`);
    lawyers.forEach((lawyer, i) => {
      console.log(`  ${i + 1}. ${lawyer.name} (${lawyer.email}) - ${lawyer.role}`);
    });

    // Get all clients
    const clients = await prisma.user.findMany({
      where: {
        role: 'USER'
      },
      select: {
        id: true,
        name: true,
        email: true,
        occupation: true
      }
    });

    console.log(`\nšŸ‘„ Found ${clients.length} clients:`);
    clients.forEach((client, i) => {
      console.log(`  ${i + 1}. ${client.name} (${client.email}) - ${client.occupation}`);
    });

    // Get all relationships
    const relationships = await prisma.clientLawyerRelationship.findMany({
      include: {
        client: {
          select: {
            name: true,
            email: true
          }
        },
        lawyer: {
          select: {
            name: true,
            email: true
          }
        },
        case: {
          select: {
            title: true
          }
        },
        milestones: true,
        testimonials: {
          where: {
            isPublic: true
          }
        }
      }
    });

    console.log(`\nšŸ¤ Found ${relationships.length} client-lawyer relationships:`);
    relationships.forEach((rel, i) => {
      console.log(`\n  ${i + 1}. ${rel.client.name} ↔ ${rel.lawyer.name}`);
      console.log(`     Type: ${rel.relationshipType}`);
      console.log(`     Status: ${rel.caseStatus || 'N/A'}`);
      console.log(`     Impact: ${rel.impactLevel || 'N/A'}`);
      console.log(`     Fee: ${rel.totalFeePaid ? `$${rel.totalFeePaid}` : 'N/A'}`);
      console.log(`     Settlement: ${rel.settlementAmount ? `$${rel.settlementAmount}` : 'N/A'}`);
      console.log(`     Satisfaction: ${rel.clientSatisfaction ? `${rel.clientSatisfaction}/5` : 'N/A'}`);
      console.log(`     Would Recommend: ${rel.wouldRecommend !== null ? (rel.wouldRecommend ? 'Yes' : 'No') : 'N/A'}`);
      console.log(`     Milestones: ${rel.milestones.length}`);
      console.log(`     Testimonials: ${rel.testimonials.length}`);
      if (rel.case) {
        console.log(`     Case: ${rel.case.title}`);
      }
    });

    // Get all testimonials
    const testimonials = await prisma.clientTestimonial.findMany({
      include: {
        client: {
          select: {
            name: true
          }
        },
        lawyer: {
          select: {
            name: true
          }
        }
      }
    });

    console.log(`\n⭐ Found ${testimonials.length} testimonials:`);
    testimonials.forEach((testimonial, i) => {
      console.log(`\n  ${i + 1}. "${testimonial.title}"`);
      console.log(`     By: ${testimonial.client.name}`);
      console.log(`     About: ${testimonial.lawyer.name}`);
      console.log(`     Category: ${testimonial.category}`);
      console.log(`     Impact: ${testimonial.impactLevel}`);
      console.log(`     Public: ${testimonial.isPublic ? 'Yes' : 'No'}`);
      console.log(`     Featured: ${testimonial.isFeatured ? 'Yes' : 'No'}`);
      console.log(`     Views: ${testimonial.views}`);
      console.log(`     Helpful Votes: ${testimonial.helpfulVotes}`);
    });

    // Get lawyer stats
    const lawyerStats = await prisma.lawyerStats.findMany({
      include: {
        lawyer: {
          select: {
            name: true
          }
        }
      }
    });

    console.log(`\nšŸ“Š Found ${lawyerStats.length} lawyer statistics:`);
    lawyerStats.forEach((stat, i) => {
      console.log(`\n  ${i + 1}. ${stat.lawyer.name}`);
      console.log(`     Total Clients: ${stat.totalClients}`);
      console.log(`     Active Clients: ${stat.activeClients}`);
      console.log(`     Win Rate: ${stat.winRate.toFixed(1)}%`);
      console.log(`     Cases Won: ${stat.casesWon}`);
      console.log(`     Cases Settled: ${stat.casesSettled}`);
      console.log(`     Cases Lost: ${stat.casesLost}`);
      console.log(`     Total Revenue: $${stat.totalRevenue}`);
      console.log(`     Pro Bono Hours: ${stat.totalProBonoHours}`);
      console.log(`     Pro Bono Value: $${stat.totalProBonoValue}`);
      console.log(`     Avg Satisfaction: ${stat.averageSatisfaction.toFixed(1)}/5`);
      console.log(`     Recommendation Rate: ${stat.recommendationRate.toFixed(1)}%`);
      console.log(`     Life-Changing Cases: ${stat.lifeChangingCases}`);
      console.log(`     Total Settlement Value: $${stat.totalSettlementValue}`);
    });

    console.log('\nšŸŽ‰ Relationship system test completed!');

  } catch (error) {
    console.error('āŒ Error testing relationships:', error);
  }
}

async function main() {
  await testRelationships();
  await prisma.$disconnect();
}

main().catch((e) => {
  console.error(e);
  process.exit(1);
}); 

CasperSecurity Mini