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-comprehensive-platform.ts
import { PrismaClient } from '@prisma/client';
import { hash } from 'bcryptjs';

const prisma = new PrismaClient();

async function seedComprehensivePlatform() {
  console.log('🌱 Starting comprehensive platform seeding...');

  try {
    // Create sample lawyers
    const lawyers = await Promise.all([
      prisma.user.create({
        data: {
          email: 'marie.champion@lawfirm.com',
          name: 'Marie Champion',
          username: 'marie-champion',
          password: await hash('lawyer123', 12),
          role: 'LAWYER',
          profilePicture: 'https://images.unsplash.com/photo-1594736797933-d0f06ba29d9e?w=400',
          bio: 'Passionate human rights lawyer with 15 years of experience fighting for justice.',
          title: 'Senior Partner',
          specialization: 'Human Rights & Civil Liberties',
          barNumber: 'QC-98765',
          yearsOfExperience: 15,
          education: 'McGill University Law School (LLB), Harvard Law School (LLM)',
          hourlyRate: 450.0,
          proBono: true,
          boldnessRating: 4.8,
          transparencyRating: 4.7,
          averageRating: 4.75,
          totalCases: 89,
          wonCases: 72,
          isVerified: true,
          xpPoints: 2450,
          level: 8,
          isProfilePublic: true,
          officeLocation: 'Montreal, QC',
          workPhone: '(514) 555-0001'
        }
      }),
      
      prisma.user.create({
        data: {
          email: 'david.justice@advocates.ca',
          name: 'David Justice',
          username: 'david-justice',
          password: await hash('lawyer123', 12),
          role: 'LAWYER',
          profilePicture: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=400',
          bio: 'Criminal defense attorney specializing in prison rights and detention conditions.',
          title: 'Principal Lawyer',
          specialization: 'Criminal Law & Prison Rights',
          barNumber: 'QC-54321',
          yearsOfExperience: 12,
          education: 'University of Toronto Law School (JD)',
          hourlyRate: 380.0,
          proBono: true,
          boldnessRating: 4.9,
          transparencyRating: 4.6,
          averageRating: 4.7,
          totalCases: 67,
          wonCases: 51,
          isVerified: true,
          xpPoints: 1890,
          level: 6,
          isProfilePublic: true,
          officeLocation: 'Toronto, ON',
          workPhone: '(416) 555-0002'
        }
      })
    ]);

    console.log('āœ… Created lawyer accounts');

    // Create sample public cases
    const cases = await Promise.all([
      prisma.legalCase.create({
        data: {
          title: 'Bordeaux Prison Conditions Class Action',
          description: 'Historic class action against Quebec for systemic rights violations at Bordeaux Prison affecting thousands of detainees from January 2022 to present.',
          publicSummary: 'Seeking justice for inhumane conditions, inadequate healthcare, and rights violations at Bordeaux Prison. Join if you were detained during the class period.',
          caseNumber: '2024QCCS4540',
          caseType: 'class_action',
          status: 'active',
          jurisdiction: 'Quebec Superior Court',
          court: 'Quebec Superior Court',
          category: 'HUMAN_RIGHTS',
          legalArea: 'Human Rights',
          urgencyLevel: 'HIGH',
          priority: 'high',
          isPublic: true,
          isAcceptingApplications: true,
          estimatedValue: 50000000,
          riskLevel: 'MEDIUM',
          tags: JSON.stringify(['prison-rights', 'class-action', 'human-rights', 'bordeaux', 'systemic-violations']),
          viewCount: 1247,
          supporterCount: 89,
          leadLawyerId: lawyers[0].id,
          createdBy: lawyers[0].id,
          filingDate: new Date('2024-03-12'),
          applicationDeadline: new Date('2025-12-31')
        }
      }),

      prisma.legalCase.create({
        data: {
          title: 'Wrongful Conviction Appeal - Michael Thompson',
          description: 'Appeal case for Michael Thompson who was wrongfully convicted of armed robbery in 2019. New evidence has emerged including DNA proof and witness recantation.',
          publicSummary: 'Fighting to overturn a wrongful conviction with new DNA evidence. Seeking experienced criminal appeals lawyer.',
          caseType: 'appeal',
          status: 'active',
          jurisdiction: 'Ontario Court of Appeal',
          court: 'Ontario Court of Appeal',
          category: 'CRIMINAL',
          legalArea: 'Criminal Appeals',
          urgencyLevel: 'URGENT',
          priority: 'urgent',
          isPublic: true,
          isAcceptingApplications: true,
          estimatedValue: 2000000,
          riskLevel: 'HIGH',
          tags: JSON.stringify(['wrongful-conviction', 'dna-evidence', 'appeal', 'criminal-law', 'innocence']),
          viewCount: 892,
          supporterCount: 156,
          leadLawyerId: lawyers[1].id,
          createdBy: lawyers[1].id,
          filingDate: new Date('2024-06-15'),
          applicationDeadline: new Date('2025-03-01')
        }
      })
    ]);

    console.log('āœ… Created public cases');

    // Create badges
    const badges = await Promise.all([
      prisma.badge.create({
        data: {
          name: 'Justice Seeker',
          description: 'Submitted your first case for legal help',
          icon: 'āš–ļø',
          category: 'ACHIEVEMENT',
          xpReward: 50,
          rarity: 'COMMON',
          requirements: JSON.stringify({ action: 'submit_case', count: 1 })
        }
      }),
      
      prisma.badge.create({
        data: {
          name: 'Pro Bono Hero',
          description: 'Completed 10 pro bono cases',
          icon: '🦸',
          category: 'PRO_BONO',
          xpReward: 500,
          rarity: 'RARE',
          requirements: JSON.stringify({ action: 'complete_pro_bono', count: 10 })
        }
      }),

      prisma.badge.create({
        data: {
          name: 'David vs Goliath',
          description: 'Won a case against a major corporation or government',
          icon: 'šŸ¹',
          category: 'ACHIEVEMENT',
          xpReward: 1000,
          rarity: 'EPIC',
          requirements: JSON.stringify({ action: 'win_major_case', count: 1 })
        }
      }),

      prisma.badge.create({
        data: {
          name: 'Platform Patron',
          description: 'Donated $1000+ to support the platform',
          icon: 'šŸ’Ž',
          category: 'DONATION',
          xpReward: 200,
          rarity: 'RARE',
          requirements: JSON.stringify({ action: 'donate', amount: 1000 })
        }
      }),

      prisma.badge.create({
        data: {
          name: 'Case Supporter',
          description: 'Supported 25 different cases',
          icon: 'ā¤ļø',
          category: 'ACHIEVEMENT',
          xpReward: 100,
          rarity: 'COMMON',
          requirements: JSON.stringify({ action: 'support_cases', count: 25 })
        }
      })
    ]);

    console.log('āœ… Created badges');

    // Create Society Degrees (1-33)
    const societyDegrees = await Promise.all([
      prisma.societyDegree.create({
        data: {
          degreeNumber: 1,
          name: 'Initiate of Justice',
          description: 'First step into the Society of Brothers. Learn the fundamentals of law and justice.',
          requirements: JSON.stringify({ xp: 0, badges: [], courses: [] }),
          xpRequired: 0,
          symbol: 'šŸ”°',
          ceremonialText: 'Welcome, Initiate, to the path of justice. Your journey begins here.'
        }
      }),

      prisma.societyDegree.create({
        data: {
          degreeNumber: 3,
          name: 'Seeker of Truth',
          description: 'Those who actively seek truth and justice in their legal practice.',
          requirements: JSON.stringify({ xp: 500, badges: ['justice_seeker'], courses: [] }),
          xpRequired: 500,
          symbol: 'šŸ”',
          ceremonialText: 'You have shown dedication to truth. Continue your quest with wisdom.'
        }
      }),

      prisma.societyDegree.create({
        data: {
          degreeNumber: 7,
          name: 'Guardian of Rights',
          description: 'Protector of fundamental human rights and civil liberties.',
          requirements: JSON.stringify({ xp: 1500, badges: ['pro_bono_hero'], courses: ['constitutional_law'] }),
          xpRequired: 1500,
          casesRequired: 10,
          symbol: 'šŸ›”ļø',
          ceremonialText: 'As Guardian, you pledge to protect the rights of all people.'
        }
      }),

      prisma.societyDegree.create({
        data: {
          degreeNumber: 21,
          name: 'Master of Law',
          description: 'Deep understanding of legal principles and exceptional case results.',
          requirements: JSON.stringify({ xp: 5000, badges: ['david_vs_goliath'], courses: ['advanced_litigation'] }),
          xpRequired: 5000,
          casesRequired: 50,
          symbol: 'āš–ļø',
          ceremonialText: 'Master, your wisdom guides others toward justice.'
        }
      }),

      prisma.societyDegree.create({
        data: {
          degreeNumber: 33,
          name: 'Grand Master of Justice',
          description: 'The highest degree. Reserved for those who have achieved legendary status in legal excellence.',
          requirements: JSON.stringify({ xp: 20000, badges: ['all_legendary'], courses: ['all_advanced'] }),
          xpRequired: 20000,
          casesRequired: 200,
          symbol: 'šŸ‘‘',
          ceremonialText: 'Grand Master, you embody the highest ideals of justice and wisdom.'
        }
      })
    ]);

    console.log('āœ… Created Society degrees');

    // Create courses
    const courses = await Promise.all([
      prisma.course.create({
        data: {
          title: 'Constitutional Law Fundamentals',
          description: 'Master the foundations of constitutional law and charter rights.',
          category: 'BEGINNER',
          level: 1,
          instructor: 'Prof. Sarah Mitchell',
          duration: 40,
          xpReward: 200,
          syllabus: JSON.stringify({
            modules: [
              'Introduction to Constitutional Law',
              'Charter of Rights and Freedoms',
              'Division of Powers',
              'Constitutional Interpretation'
            ]
          }),
          price: 0.0
        }
      }),

      prisma.course.create({
        data: {
          title: 'Advanced Litigation Strategies',
          description: 'Advanced techniques for complex litigation and case management.',
          category: 'ADVANCED',
          level: 15,
          instructor: 'Justice Robert Chen',
          duration: 60,
          xpReward: 500,
          badgeReward: badges[2].id, // David vs Goliath
          prerequisites: JSON.stringify(['constitutional_law_fundamentals']),
          syllabus: JSON.stringify({
            modules: [
              'Case Strategy Development',
              'Evidence Presentation',
              'Cross-Examination Techniques',
              'Appeal Procedures'
            ]
          }),
          price: 299.0
        }
      }),

      prisma.course.create({
        data: {
          title: 'Prison Rights & Detention Law',
          description: 'Specialized course on prisoner rights and detention conditions.',
          category: 'INTERMEDIATE',
          level: 7,
          instructor: 'Danny William Perez',
          duration: 30,
          xpReward: 300,
          syllabus: JSON.stringify({
            modules: [
              'Prisoner Rights Overview',
              'Detention Standards',
              'Class Action Procedures',
              'Systemic Reform Strategies'
            ]
          }),
          price: 150.0
        }
      })
    ]);

    console.log('āœ… Created courses');

    // Create law library resources
    const lawResources = await Promise.all([
      prisma.lawResource.create({
        data: {
          title: 'Charter of Rights and Freedoms - Complete Guide',
          type: 'STATUTE',
          category: 'CIVIL_CODE',
          description: 'Comprehensive guide to the Canadian Charter of Rights and Freedoms',
          author: 'Government of Canada',
          publicationDate: new Date('1982-04-17'),
          url: 'https://laws-lois.justice.gc.ca/eng/const/page-12.html',
          tags: JSON.stringify(['charter', 'constitutional', 'rights', 'freedoms']),
          difficultyLevel: 'INTERMEDIATE',
          viewCount: 5647
        }
      }),

      prisma.lawResource.create({
        data: {
          title: 'R. v. Oakes - Proportionality Test',
          type: 'CASE_LAW',
          category: 'COMMON_LAW',
          description: 'Landmark Supreme Court case establishing the Oakes test for Charter limitations',
          author: 'Supreme Court of Canada',
          publicationDate: new Date('1986-02-28'),
          tags: JSON.stringify(['oakes-test', 'charter', 'supreme-court', 'proportionality']),
          difficultyLevel: 'ADVANCED',
          viewCount: 3421
        }
      }),

      prisma.lawResource.create({
        data: {
          title: 'Environmental Law Handbook',
          type: 'BOOK',
          category: 'LAND_LAW',
          description: 'Comprehensive handbook covering environmental protection laws',
          author: 'Dr. Emma Green',
          publisher: 'Legal Education Press',
          isbn: '978-0-123456-78-9',
          publicationDate: new Date('2023-01-15'),
          tags: JSON.stringify(['environment', 'regulations', 'land-use', 'protection']),
          difficultyLevel: 'INTERMEDIATE',
          viewCount: 1234
        }
      })
    ]);

    console.log('āœ… Created law resources');

    // Create some case offers
    await Promise.all([
      prisma.caseOffer.create({
        data: {
          caseId: cases[1].id, // Wrongful conviction case
          lawyerId: lawyers[1].id, // David Justice
          receiverId: lawyers[1].id, // Self-created case
          offerType: 'COLLABORATE',
          message: 'I have extensive experience with wrongful conviction appeals and would love to collaborate on this important case.',
          proposedRate: 300.0,
          estimatedHours: 120,
          status: 'PENDING'
        }
      }),

      prisma.caseOffer.create({
        data: {
          caseId: cases[0].id, // Bordeaux Prison case
          lawyerId: lawyers[0].id, // Marie Champion
          receiverId: lawyers[1].id, // David Justice
          offerType: 'REPRESENT',
          message: 'This class action case aligns perfectly with my human rights practice. I offer my services pro bono.',
          proposedRate: 0.0,
          estimatedHours: 80,
          status: 'PENDING'
        }
      })
    ]);

    console.log('āœ… Created case offers');

    // Award some badges to lawyers
    await Promise.all([
      prisma.userBadge.create({
        data: {
          userId: lawyers[0].id,
          badgeId: badges[1].id // Pro Bono Hero
        }
      }),
      
      prisma.userBadge.create({
        data: {
          userId: lawyers[1].id,
          badgeId: badges[2].id // David vs Goliath
        }
      }),

      prisma.userBadge.create({
        data: {
          userId: lawyers[0].id,
          badgeId: badges[0].id // Justice Seeker
        }
      })
    ]);

    console.log('āœ… Awarded badges to lawyers');

    // Create some sample case support
    const regularUsers = await prisma.user.findMany({
      where: { role: 'USER' },
      take: 5
    });

    if (regularUsers.length > 0) {
      for (const user of regularUsers) {
        // Each user supports 1-2 random cases
        const casesToSupport = cases.slice(0, Math.floor(Math.random() * 2) + 1);
        
        for (const supportedCase of casesToSupport) {
          try {
            await prisma.caseSupport.create({
              data: {
                userId: user.id,
                caseId: supportedCase.id
              }
            });
          } catch (error) {
            // Skip if already exists
          }
        }
      }
      console.log('āœ… Created case support records');
    }

    console.log('šŸŽ‰ Comprehensive platform seeding completed successfully!');
    console.log('\nšŸ“Š Summary:');
    console.log(`- Created ${lawyers.length} lawyer accounts`);
    console.log(`- Created ${cases.length} public cases`);
    console.log(`- Created ${badges.length} achievement badges`);
    console.log(`- Created ${societyDegrees.length} Society degrees`);
    console.log(`- Created ${courses.length} educational courses`);
    console.log(`- Created ${lawResources.length} law library resources`);

  } catch (error) {
    console.error('āŒ Error seeding platform:', error);
    throw error;
  } finally {
    await prisma.$disconnect();
  }
}

// Run the seed if called directly
if (require.main === module) {
  seedComprehensivePlatform()
    .catch((error) => {
      console.error(error);
      process.exit(1);
    });
}

export { seedComprehensivePlatform }; 

CasperSecurity Mini