![]() 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/backups/lavocat.quebec/backup-20250730-021618/src/pages/api/ |
import { NextApiRequest, NextApiResponse } from 'next';
import { prisma } from '@/lib/prisma';
import { sendEmail } from '@/utils/email';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== 'POST') {
return res.status(405).json({ message: 'Method not allowed' });
}
try {
const {
name,
email,
phone,
barNumber,
specialization,
yearsOfExperience,
education,
officeLocation,
linkedinUrl,
websiteUrl,
bio,
motivation
} = req.body;
// Validate required fields
if (!name || !email || !phone || !barNumber || !specialization || !yearsOfExperience || !education || !bio || !motivation) {
return res.status(400).json({ message: 'Missing required fields' });
}
// Check if email already exists
const existingUser = await prisma.user.findUnique({
where: { email }
});
if (existingUser) {
return res.status(400).json({ message: 'Un compte avec cette adresse email existe déjà' });
}
// For now, we'll store in a temporary table or send email
// In a real implementation, you'd create a LawyerApplication model
console.log('New lawyer application received:', {
name,
email,
specialization,
yearsOfExperience,
barNumber
});
res.status(200).json({
message: 'Application submitted successfully'
});
} catch (error) {
console.error('Lawyer signup error:', error);
res.status(500).json({ message: 'Internal server error' });
}
}