![]() 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/ |
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function addBarreauVerification() {
try {
console.log('🔧 Adding Barreau verification fields...\n');
// This script will be run after the Prisma migration
// For now, we'll update existing lawyers to have verification status
const lawyers = await prisma.user.findMany({
where: { role: 'LAWYER' }
});
console.log(`Found ${lawyers.length} existing lawyers`);
for (const lawyer of lawyers) {
// Update existing lawyers with basic verification
await prisma.user.update({
where: { id: lawyer.id },
data: {
verificationStatus: 'VERIFIED',
isVerified: true,
specializations: JSON.stringify(lawyer.specialization ? [lawyer.specialization] : []),
regions: JSON.stringify(lawyer.officeLocation ? [lawyer.officeLocation] : ['Montréal']),
acceptsLegalAid: true,
barreauStatus: 'ACTIVE'
}
});
console.log(`✅ Updated ${lawyer.name} with verification status`);
}
// Update ADW team specifically
const adwTeam = await prisma.user.findMany({
where: {
email: {
contains: 'adwavocats.ca'
}
}
});
for (const member of adwTeam) {
await prisma.user.update({
where: { id: member.id },
data: {
verificationStatus: 'VERIFIED_BARREAU',
barreauVerifiedAt: new Date(),
barreauId: `ADW-${member.barNumber || '001'}`,
specializations: JSON.stringify(member.specialization ? [member.specialization] : ['Droit civil', 'Droit commercial']),
regions: JSON.stringify(['Montréal']),
acceptsLegalAid: true,
barreauStatus: 'ACTIVE'
}
});
console.log(`✅ Updated ADW member ${member.name} with Barreau verification`);
}
console.log('\n🎉 Barreau verification fields added successfully!');
console.log('📊 Summary:');
console.log(` - Updated ${lawyers.length} lawyers with verification status`);
console.log(` - Updated ${adwTeam.length} ADW team members with Barreau verification`);
} catch (error) {
console.error('❌ Error adding Barreau verification:', error);
} finally {
await prisma.$disconnect();
}
}
addBarreauVerification();