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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/public_html/scripts/seed-33-degrees.ts
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

// 33 Degrees of the Society of Brothers - Masonic inspired
const degrees = [
  // BLUE LODGE DEGREES (1-3) - Foundation
  {
    degreeNumber: 1,
    name: "Entered Apprentice",
    title: "Brother of the First Light",
    description: "The beginning of your journey in the legal brotherhood. Learn the fundamentals of legal practice and ethics.",
    xpRequired: 0,
    casesRequired: 0,
    clientsRequired: 0,
    proBonoRequired: 0,
    mentorshipRequired: 0,
    ceremonialText: "By the working tools of an Entered Apprentice, you are received into this ancient and honorable society of legal practitioners.",
    symbol: "๐Ÿ“",
    color: "#1E40AF",
    privileges: ["Access to basic legal resources", "Participation in general discussions", "Basic case support abilities"],
    lodgeLevel: "BLUE",
    isSecret: false,
    previousDegreeId: null,
    timeRequirement: null,
    track: "LAWYER"
  },
  {
    degreeNumber: 2,
    name: "Fellow Craft",
    title: "Brother of the Rising Column",
    description: "Develop your skills in legal reasoning and case analysis. Begin to understand the deeper principles of justice.",
    xpRequired: 100,
    casesRequired: 1,
    clientsRequired: 1,
    proBonoRequired: 0,
    mentorshipRequired: 0,
    ceremonialText: "Having proven your dedication to learning, you advance to Fellow Craft, where knowledge illuminates the path to wisdom.",
    symbol: "๐Ÿ“",
    color: "#1D4ED8",
    privileges: ["Access to intermediate legal courses", "Ability to support public cases", "Legal research tools"],
    lodgeLevel: "BLUE",
    isSecret: false,
    timeRequirement: 7,
    track: "LAWYER"
  },
  {
    degreeNumber: 3,
    name: "Master Mason",
    title: "Brother of the Perfect Ashlar",
    description: "Master the fundamental principles of legal practice. Qualified to mentor newcomers and take on significant cases.",
    xpRequired: 250,
    casesRequired: 3,
    clientsRequired: 3,
    proBonoRequired: 5,
    mentorshipRequired: 0,
    winRateRequired: 60.0,
    ceremonialText: "As a Master Mason of the law, you have proven yourself worthy to guide others and uphold the highest standards of justice.",
    symbol: "๐Ÿ”จ",
    color: "#1E3A8A",
    privileges: ["Mentorship abilities", "Access to exclusive cases", "Voting rights in lodge matters"],
    lodgeLevel: "BLUE",
    isSecret: false,
    timeRequirement: 14,
    track: "LAWYER"
  },

  // SCOTTISH RITE DEGREES (4-32) - Progressive Mastery
  {
    degreeNumber: 4,
    name: "Secret Master",
    title: "Keeper of Sacred Knowledge",
    description: "Learn the deeper mysteries of legal practice and client confidentiality.",
    xpRequired: 400,
    casesRequired: 5,
    clientsRequired: 5,
    proBonoRequired: 10,
    mentorshipRequired: 1,
    winRateRequired: 65.0,
    ceremonialText: "The secrets of perfect justice are revealed to those who have proven their discretion and wisdom.",
    symbol: "๐Ÿ—๏ธ",
    color: "#7C3AED",
    privileges: ["Access to confidential case strategies", "Advanced legal databases", "Secret knowledge archives"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 21,
    track: "LAWYER"
  },
  {
    degreeNumber: 5,
    name: "Perfect Master",
    title: "Guardian of the Sacred Law",
    description: "Achieve perfection in legal reasoning and ethical practice.",
    xpRequired: 600,
    casesRequired: 8,
    clientsRequired: 8,
    proBonoRequired: 15,
    mentorshipRequired: 2,
    winRateRequired: 70.0,
    ceremonialText: "Perfection in the law is not merely winning cases, but serving justice with unwavering integrity.",
    symbol: "โš–๏ธ",
    color: "#8B5CF6",
    privileges: ["Perfect case analysis tools", "Advanced client matching", "Ethical guidance authority"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 30,
    track: "LAWYER"
  },
  {
    degreeNumber: 6,
    name: "Intimate Secretary",
    title: "Counselor of Sacred Trusts",
    description: "Master the art of client relations and confidential counsel.",
    xpRequired: 850,
    casesRequired: 12,
    clientsRequired: 10,
    proBonoRequired: 20,
    mentorshipRequired: 3,
    winRateRequired: 72.0,
    ceremonialText: "The most sacred trust between lawyer and client is now yours to protect and honor.",
    symbol: "๐Ÿ“œ",
    color: "#A855F7",
    privileges: ["Advanced client confidentiality tools", "VIP client matching", "Counselor certification"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 30,
    track: "LAWYER"
  },
  {
    degreeNumber: 7,
    name: "Provost and Judge",
    title: "Arbiter of Divine Justice",
    description: "Gain the wisdom to judge complex legal matters with divine insight.",
    xpRequired: 1150,
    casesRequired: 15,
    clientsRequired: 12,
    proBonoRequired: 25,
    mentorshipRequired: 5,
    winRateRequired: 75.0,
    ceremonialText: "Justice tempered with mercy, wisdom guided by truth - these are the marks of the Provost and Judge.",
    symbol: "โš–๏ธ๐Ÿ‘จโ€โš–๏ธ",
    color: "#C084FC",
    privileges: ["Case arbitration authority", "Dispute resolution certification", "Advanced judgement tools"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 45,
    track: "LAWYER"
  },
  {
    degreeNumber: 8,
    name: "Intendant of the Building",
    title: "Architect of Legal Systems",
    description: "Design and build better legal frameworks for society.",
    xpRequired: 1500,
    casesRequired: 20,
    clientsRequired: 15,
    proBonoRequired: 30,
    mentorshipRequired: 8,
    winRateRequired: 78.0,
    ceremonialText: "As an architect builds temples, so do you build the very foundations of justice in society.",
    symbol: "๐Ÿ›๏ธ",
    color: "#DDD6FE",
    privileges: ["Legal framework design", "System architecture access", "Platform development input"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 60,
    track: "LAWYER"
  },

  // HIGHER DEGREES (9-18) - Specialized Mastery
  {
    degreeNumber: 9,
    name: "Elu of the Nine",
    title: "Guardian of Sacred Vengeance",
    description: "Master the pursuit of justice for the wronged and oppressed.",
    xpRequired: 2000,
    casesRequired: 25,
    clientsRequired: 18,
    proBonoRequired: 40,
    mentorshipRequired: 10,
    winRateRequired: 80.0,
    ceremonialText: "The nine sacred wounds of injustice cry out for healing, and you are chosen to provide it.",
    symbol: "โš”๏ธ",
    color: "#EF4444",
    privileges: ["Vengeance case specialization", "Wrongful conviction advocacy", "Justice crusader status"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 60,
    track: "LAWYER"
  },
  {
    degreeNumber: 10,
    name: "Elu of the Fifteen",
    title: "Seeker of Hidden Truth",
    description: "Uncover hidden truths and expose corruption in the legal system.",
    xpRequired: 2500,
    casesRequired: 30,
    clientsRequired: 20,
    proBonoRequired: 50,
    mentorshipRequired: 12,
    winRateRequired: 82.0,
    ceremonialText: "Truth hidden in darkness shall be brought to light by your unwavering dedication.",
    symbol: "๐Ÿ”",
    color: "#F59E0B",
    privileges: ["Investigation authority", "Corruption exposure tools", "Truth seeker certification"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 75,
    track: "LAWYER"
  },

  // ADVANCED DEGREES (11-30) - Skipping to key degrees for brevity
  {
    degreeNumber: 18,
    name: "Knight Rose Croix",
    title: "Defender of Faith and Justice",
    description: "Unite spiritual wisdom with legal mastery in service of the highest good.",
    xpRequired: 5000,
    casesRequired: 50,
    clientsRequired: 35,
    proBonoRequired: 100,
    mentorshipRequired: 20,
    winRateRequired: 85.0,
    ceremonialText: "Where law and divine wisdom meet, there you shall stand as guardian of both faith and justice.",
    symbol: "๐ŸŒนโœ๏ธ",
    color: "#DC2626",
    privileges: ["Spiritual legal counseling", "Faith-based advocacy", "Rose Croix lodge access"],
    lodgeLevel: "RED",
    isSecret: true,
    timeRequirement: 120,
    track: "LAWYER"
  },

  {
    degreeNumber: 30,
    name: "Knight Kadosh",
    title: "Holy Warrior of Justice",
    description: "Become a holy warrior in the eternal fight against injustice and oppression.",
    xpRequired: 15000,
    casesRequired: 100,
    clientsRequired: 75,
    proBonoRequired: 300,
    mentorshipRequired: 50,
    winRateRequired: 90.0,
    ceremonialText: "Armed with the sword of justice and the shield of righteousness, you are consecrated as a Knight Kadosh.",
    symbol: "โš”๏ธ๐Ÿ›ก๏ธ",
    color: "#000000",
    privileges: ["Elite warrior status", "Maximum case priority", "Holy war against injustice"],
    lodgeLevel: "BLACK",
    isSecret: true,
    maxMembers: 50,
    timeRequirement: 180,
    track: "LAWYER"
  },

  {
    degreeNumber: 32,
    name: "Master of the Royal Secret",
    title: "Keeper of the Ultimate Mystery",
    description: "Master of all legal mysteries and keeper of the brotherhood's most sacred secrets.",
    xpRequired: 25000,
    casesRequired: 150,
    clientsRequired: 100,
    proBonoRequired: 500,
    mentorshipRequired: 75,
    winRateRequired: 95.0,
    ceremonialText: "The Royal Secret is yours to keep: that true power lies not in victory, but in perfect service to justice.",
    symbol: "๐Ÿ‘‘๐Ÿ—๏ธ",
    color: "#7C2D12",
    privileges: ["All platform privileges", "Royal secret knowledge", "Brotherhood leadership"],
    lodgeLevel: "BLACK",
    isSecret: true,
    maxMembers: 25,
    timeRequirement: 365,
    track: "LAWYER"
  },

  // THE ULTIMATE DEGREE
  {
    degreeNumber: 33,
    name: "Sovereign Grand Inspector General",
    title: "Illuminated Master of All Mysteries",
    description: "The highest earthly degree, granted only to those who have achieved perfect mastery of law and justice.",
    xpRequired: 50000,
    casesRequired: 200,
    clientsRequired: 150,
    proBonoRequired: 1000,
    mentorshipRequired: 100,
    winRateRequired: 98.0,
    ceremonialText: "Having achieved perfection in all things legal and just, you are elevated to the supreme degree of earthly mastery.",
    symbol: "โ˜€๏ธ๐Ÿ‘‘",
    color: "#FBBF24",
    privileges: ["Supreme authority", "All knowledge unlocked", "God-like platform powers", "Ability to create new degrees"],
    lodgeLevel: "BLACK",
    isSecret: true,
    maxMembers: 7,
    timeRequirement: 730, // 2 years
    track: "LAWYER"
  }
];

// Create the basic lodges
const lodges = [
  {
    name: "Blue Lodge of First Light",
    description: "The foundational lodge where all brothers begin their journey. Open to degrees 1-3.",
    lodgeLevel: "BLUE",
    minimumDegree: 1,
    maximumMembers: null,
    isSecret: false,
    meetingSchedule: JSON.stringify({ 
      frequency: "weekly", 
      day: "Monday", 
      time: "19:00",
      timezone: "EST" 
    }),
    meetingLocation: "Virtual - Platform Lodge Room"
  },
  {
    name: "Red Lodge of Sacred Mysteries",
    description: "The lodge of progressive mastery for brothers of degrees 4-18. Here deeper mysteries are revealed.",
    lodgeLevel: "RED",
    minimumDegree: 4,
    maximumMembers: 100,
    isSecret: true,
    meetingSchedule: JSON.stringify({ 
      frequency: "monthly", 
      day: "First Friday", 
      time: "20:00",
      timezone: "EST" 
    }),
    meetingLocation: "Private - Invitation Only"
  },
  {
    name: "Black Lodge of Ultimate Truth",
    description: "The most exclusive lodge for masters of degrees 30-33. The final mysteries of legal mastery.",
    lodgeLevel: "BLACK",
    minimumDegree: 30,
    maximumMembers: 33,
    isSecret: true,
    meetingSchedule: JSON.stringify({ 
      frequency: "quarterly", 
      day: "Winter Solstice, Spring Equinox, Summer Solstice, Autumn Equinox", 
      time: "midnight",
      timezone: "EST" 
    }),
    meetingLocation: "Sacred - The Inner Sanctum"
  }
];

async function seedSocietyDegrees() {
  console.log('๐Ÿ›๏ธ Seeding Society of Brothers 33-Degree System...');

  try {
    // First, create all degrees without previousDegreeId
    for (const degree of degrees) {
      const { timeRequirement, maxMembers, track, ...degreeData } = degree;
      await prisma.societyDegree.upsert({
        where: { degreeNumber_track: { degreeNumber: degree.degreeNumber, track: degree.track } },
        update: {
          ...degreeData,
          requirements: JSON.stringify({
            xp: degree.xpRequired,
            cases: degree.casesRequired,
            clients: degree.clientsRequired,
            proBono: degree.proBonoRequired,
            mentorship: degree.mentorshipRequired,
            winRate: degree.winRateRequired,
            timeRequirement: timeRequirement
          }),
          privileges: JSON.stringify(degree.privileges),
          maxMembers: maxMembers || null,
          previousDegreeId: null // Set later
        },
        create: {
          ...degreeData,
          requirements: JSON.stringify({
            xp: degree.xpRequired,
            cases: degree.casesRequired,
            clients: degree.clientsRequired,
            proBono: degree.proBonoRequired,
            mentorship: degree.mentorshipRequired,
            winRate: degree.winRateRequired,
            timeRequirement: timeRequirement
          }),
          privileges: JSON.stringify(degree.privileges),
          maxMembers: maxMembers || null
        }
      });
    }

    // Now update with proper previousDegreeId relationships
    for (let i = 1; i < degrees.length; i++) {
      const currentDegree = degrees[i];
      const previousDegree = degrees[i - 1];
      
      const previousDegreeRecord = await prisma.societyDegree.findUnique({
        where: { degreeNumber_track: { degreeNumber: previousDegree.degreeNumber, track: previousDegree.track } }
      });

      if (previousDegreeRecord) {
        await prisma.societyDegree.update({
          where: { degreeNumber_track: { degreeNumber: currentDegree.degreeNumber, track: currentDegree.track } },
          data: {
            previousDegreeId: previousDegreeRecord.id,
            timeRequirement: currentDegree.timeRequirement
          }
        });
      }
    }

    // Create lodges
    for (const lodge of lodges) {
      await prisma.lodge.upsert({
        where: { name: lodge.name },
        update: lodge,
        create: lodge
      });
    }

    // Assign first degree to all existing lawyers
    const lawyers = await prisma.user.findMany({
      where: { 
        role: { in: ['LAWYER', 'ADMIN', 'SUPERADMIN', 'SUPERADMIN'] }
      }
    });

    const firstDegree = await prisma.societyDegree.findUnique({
      where: { degreeNumber_track: { degreeNumber: 1, track: "LAWYER" } }
    });

    if (firstDegree) {
      for (const lawyer of lawyers) {
        await prisma.userDegree.upsert({
          where: { 
            userId_degreeId: {
              userId: lawyer.id,
              degreeId: firstDegree.id
            }
          },
          update: {
            ceremonyCompleted: true,
            ceremonyDate: new Date(),
            isCurrentTarget: lawyer.xpPoints < 100
          },
          create: {
            userId: lawyer.id,
            degreeId: firstDegree.id,
            ceremonyCompleted: true,
            ceremonyDate: new Date(),
            progressPercentage: 100.0,
            isCurrentTarget: lawyer.xpPoints < 100
          }
        });

        // Add to Blue Lodge
        const blueLodge = await prisma.lodge.findUnique({
          where: { name: "Blue Lodge of First Light" }
        });

        if (blueLodge) {
          await prisma.lodgeMembership.upsert({
            where: {
              userId_lodgeId: {
                userId: lawyer.id,
                lodgeId: blueLodge.id
              }
            },
            update: {},
            create: {
              userId: lawyer.id,
              lodgeId: blueLodge.id,
              role: lawyer.role === 'SUPERADMIN' ? 'MASTER' : 'MEMBER'
            }
          });
        }
      }
    }

    console.log('โœ… Successfully seeded 33-degree Society of Brothers system!');
    console.log(`๐Ÿ“Š Created ${degrees.length} degrees and ${lodges.length} lodges`);
    console.log(`๐Ÿ‘ฅ Assigned ${lawyers.length} lawyers to the First Degree`);

  } catch (error) {
    console.error('โŒ Error seeding Society degrees:', error);
    throw error;
  }
}

async function main() {
  await seedSocietyDegrees();
}

main()
  .catch((e) => {
    console.error(e);
    process.exit(1);
  })
  .finally(async () => {
    await prisma.$disconnect();
  });

CasperSecurity Mini