![]() 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/public_html/scripts/ |
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function createSampleCalendarEvents() {
try {
console.log('Creating sample calendar events...');
// Get a lawyer user
const lawyer = await prisma.user.findFirst({
where: { role: 'LAWYER' }
});
if (!lawyer) {
console.error('No lawyer user found. Please create a lawyer user first.');
return;
}
// Get some cases (LegalCase model)
const cases = await prisma.legalCase.findMany({
take: 3
});
// Get some clients
const clients = await prisma.user.findMany({
where: { role: 'CLIENT' },
take: 3
});
const sampleEvents = [
{
title: 'Client Consultation - John Doe',
description: 'Initial consultation with client regarding personal injury case',
eventType: 'CONSULTATION',
date: new Date(Date.now() + 2 * 60 * 60 * 1000), // 2 hours from now
startTime: '14:00',
endTime: '15:00',
duration: 60,
priority: 'MEDIUM',
caseId: cases[0]?.id,
clientId: clients[0]?.id,
lawyerId: lawyer.id,
location: 'Office - Conference Room A',
isVirtual: true,
meetingLink: 'https://meet.google.com/abc-defg-hij',
status: 'SCHEDULED'
},
{
title: 'Court Hearing - Smith vs. Corporation',
description: 'Motion hearing for summary judgment',
eventType: 'COURT_HEARING',
date: new Date(Date.now() + 24 * 60 * 60 * 1000), // Tomorrow
startTime: '09:00',
endTime: '11:00',
duration: 120,
priority: 'HIGH',
caseId: cases[1]?.id,
lawyerId: lawyer.id,
location: 'Quebec Superior Court - Room 301',
isVirtual: false,
courtJurisdiction: 'Quebec Superior Court',
status: 'CONFIRMED'
},
{
title: 'Client Meeting - Jane Smith',
description: 'Follow-up meeting to discuss settlement offer',
eventType: 'CLIENT_MEETING',
date: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7 days from now
startTime: '13:00',
endTime: '14:30',
duration: 90,
priority: 'MEDIUM',
caseId: cases[2]?.id,
clientId: clients[1]?.id,
lawyerId: lawyer.id,
location: 'Client Office - Downtown',
isVirtual: false,
status: 'SCHEDULED'
},
{
title: 'Filing Deadline - Motion for Discovery',
description: 'Deadline to file motion for additional discovery',
eventType: 'FILING_DEADLINE',
date: new Date(Date.now() + 3 * 24 * 60 * 60 * 1000), // 3 days from now
startTime: '17:00',
endTime: '18:00',
duration: 60,
priority: 'CRITICAL',
caseId: cases[0]?.id,
lawyerId: lawyer.id,
status: 'SCHEDULED'
},
{
title: 'Deposition - Expert Witness',
description: 'Deposition of expert witness in personal injury case',
eventType: 'DEPOSITION',
date: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000), // 5 days from now
startTime: '10:00',
endTime: '12:00',
duration: 120,
priority: 'HIGH',
caseId: cases[1]?.id,
lawyerId: lawyer.id,
location: 'Law Office - Deposition Room',
isVirtual: false,
status: 'CONFIRMED'
},
{
title: 'Mediation Session',
description: 'Mediation session to resolve dispute',
eventType: 'MEDIATION',
date: new Date(Date.now() + 10 * 24 * 60 * 60 * 1000), // 10 days from now
startTime: '14:00',
endTime: '16:00',
duration: 120,
priority: 'MEDIUM',
caseId: cases[2]?.id,
lawyerId: lawyer.id,
location: 'Mediation Center',
isVirtual: false,
status: 'SCHEDULED'
},
{
title: 'Discovery Deadline',
description: 'Deadline for completing discovery phase',
eventType: 'DISCOVERY_DEADLINE',
date: new Date(Date.now() + 14 * 24 * 60 * 60 * 1000), // 14 days from now
startTime: '17:00',
endTime: '18:00',
duration: 60,
priority: 'CRITICAL',
caseId: cases[0]?.id,
lawyerId: lawyer.id,
status: 'SCHEDULED'
},
{
title: 'New Client Consultation',
description: 'Initial consultation for potential new employment law case',
eventType: 'CONSULTATION',
date: new Date(Date.now() + 12 * 24 * 60 * 60 * 1000), // 12 days from now
startTime: '15:00',
endTime: '17:00',
duration: 120,
priority: 'MEDIUM',
clientId: clients[2]?.id,
lawyerId: lawyer.id,
location: 'Office - Consultation Room',
isVirtual: true,
meetingLink: 'https://meet.google.com/new-case-123',
status: 'SCHEDULED'
}
];
for (const eventData of sampleEvents) {
const event = await prisma.calendarEvent.create({
data: eventData
});
console.log(`Created calendar event: ${event.title}`);
}
console.log('Sample calendar events created successfully!');
} catch (error) {
console.error('Error creating sample calendar events:', error);
} finally {
await prisma.$disconnect();
}
}
createSampleCalendarEvents();