Files
vip-coordinator/populate-events.js

300 lines
8.2 KiB
JavaScript

// Script to populate Events and Meetings for VIPs in VIP Coordinator
const API_BASE = 'http://localhost:3000/api';
// Function to add events and meetings for VIPs
async function addEventsAndMeetings() {
console.log('\n🚀 Adding Events and Meetings...');
let successCount = 0;
// VIP 1 - Sarah Johnson
let response = await fetch(`${API_BASE}/vips/1/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Arrival at DEN',
location: 'Denver International Airport',
startTime: '2025-06-26T09:00:00',
endTime: '2025-06-26T10:00:00',
type: 'transport',
assignedDriverId: '1'
})
});
if (response.ok) {
console.log(' ✅ Added arrival event for Sarah Johnson');
successCount++;
} else {
console.error(' ❌ Failed to add arrival event for Sarah Johnson');
}
response = await fetch(`${API_BASE}/vips/1/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Meeting with CEO',
location: 'Hyatt Regency Denver',
startTime: '2025-06-26T11:00:00',
endTime: '2025-06-26T12:30:00',
type: 'meeting',
assignedDriverId: '1'
})
});
if (response.ok) {
console.log(' ✅ Added meeting event for Sarah Johnson');
successCount++;
} else {
console.error(' ❌ Failed to add meeting event for Sarah Johnson');
}
response = await fetch(`${API_BASE}/vips/1/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Lunch with Board Members',
location: 'Elway\'s Downtown',
startTime: '2025-06-26T13:00:00',
endTime: '2025-06-26T14:30:00',
type: 'meal',
assignedDriverId: '1'
})
});
if (response.ok) {
console.log(' ✅ Added lunch event for Sarah Johnson');
successCount++;
} else {
console.error(' ❌ Failed to add lunch event for Sarah Johnson');
}
// VIP 2 - Michael Chen
response = await fetch(`${API_BASE}/vips/2/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Arrival at DEN',
location: 'Denver International Airport',
startTime: '2025-06-26T10:00:00',
endTime: '2025-06-26T11:00:00',
type: 'transport',
assignedDriverId: '2'
})
});
if (response.ok) {
console.log(' ✅ Added arrival event for Michael Chen');
successCount++;
} else {
console.error(' ❌ Failed to add arrival event for Michael Chen');
}
response = await fetch(`${API_BASE}/vips/2/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Meeting with Investors',
location: 'Denver Marriott City Center',
startTime: '2025-06-26T11:30:00',
endTime: '2025-06-26T13:00:00',
type: 'meeting',
assignedDriverId: '2'
})
});
if (response.ok) {
console.log(' ✅ Added meeting event for Michael Chen');
successCount++;
} else {
console.error(' ❌ Failed to add meeting event for Michael Chen');
}
response = await fetch(`${API_BASE}/vips/2/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Lunch with Colleagues',
location: 'Linger',
startTime: '2025-06-26T13:30:00',
endTime: '2025-06-26T15:00:00',
type: 'meal',
assignedDriverId: '2'
})
});
if (response.ok) {
console.log(' ✅ Added lunch event for Michael Chen');
successCount++;
} else {
console.error(' ❌ Failed to add lunch event for Michael Chen');
}
// VIP 3 - Emily Rodriguez
response = await fetch(`${API_BASE}/vips/3/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Arrival at DEN',
location: 'Denver International Airport',
startTime: '2025-06-27T09:00:00',
endTime: '2025-06-27T10:00:00',
type: 'transport',
assignedDriverId: '3'
})
});
if (response.ok) {
console.log(' ✅ Added arrival event for Emily Rodriguez');
successCount++;
} else {
console.error(' ❌ Failed to add arrival event for Emily Rodriguez');
}
response = await fetch(`${API_BASE}/vips/3/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Meeting with Healthcare Partners',
location: 'Denver Convention Center',
startTime: '2025-06-27T10:30:00',
endTime: '2025-06-27T12:00:00',
type: 'meeting',
assignedDriverId: '3'
})
});
if (response.ok) {
console.log(' ✅ Added meeting event for Emily Rodriguez');
successCount++;
} else {
console.error(' ❌ Failed to add meeting event for Emily Rodriguez');
}
response = await fetch(`${API_BASE}/vips/3/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Lunch with Healthcare Executives',
location: 'Linger',
startTime: '2025-06-27T12:30:00',
endTime: '2025-06-27T14:00:00',
type: 'meal',
assignedDriverId: '3'
})
});
if (response.ok) {
console.log(' ✅ Added lunch event for Emily Rodriguez');
successCount++;
} else {
console.error(' ❌ Failed to add lunch event for Emily Rodriguez');
}
// VIP 4 - David Thompson (self-driving)
// No events needed
// VIP 5 - Lisa Wang
response = await fetch(`${API_BASE}/vips/5/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Arrival at DEN',
location: 'Denver International Airport',
startTime: '2025-06-26T08:00:00',
endTime: '2025-06-26T09:00:00',
type: 'transport',
assignedDriverId: '4'
})
});
if (response.ok) {
console.log(' ✅ Added arrival event for Lisa Wang');
successCount++;
} else {
console.error(' ❌ Failed to add arrival event for Lisa Wang');
}
response = await fetch(`${API_BASE}/vips/5/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Keynote Presentation',
location: 'Denver Convention Center',
startTime: '2025-06-26T10:00:00',
endTime: '2025-06-26T11:30:00',
type: 'event',
assignedDriverId: '4'
})
});
if (response.ok) {
console.log(' ✅ Added keynote event for Lisa Wang');
successCount++;
} else {
console.error(' ❌ Failed to add keynote event for Lisa Wang');
}
response = await fetch(`${API_BASE}/vips/5/schedule`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Lunch with Conference Organizers',
location: 'Elway\'s Downtown',
startTime: '2025-06-26T12:00:00',
endTime: '2025-06-26T13:30:00',
type: 'meal',
assignedDriverId: '4'
})
});
if (response.ok) {
console.log(' ✅ Added lunch event for Lisa Wang');
successCount++;
} else {
console.error(' ❌ Failed to add lunch event for Lisa Wang');
}
console.log(`\nAdded ${successCount} events successfully`);
}
// Main function
async function populateEventsAndMeetings() {
console.log('🚀 Starting to populate Events and Meetings...\n');
// Check if API is available
try {
const healthCheck = await fetch(`${API_BASE}/health`);
if (!healthCheck.ok) {
console.error('❌ API is not responding. Make sure the backend is running on port 3000');
return;
}
} catch (error) {
console.error('❌ Cannot connect to API. Make sure the backend is running on port 3000');
return;
}
await addEventsAndMeetings();
console.log('\n✅ Events and Meetings population complete!');
console.log('\nYou can now:');
console.log('1. View all VIPs at http://localhost:5173/vips');
console.log('2. Manage drivers at http://localhost:5173/drivers');
console.log('3. Create schedules for the VIPs');
console.log('4. Test flight tracking and validation');
}
// Run the script
populateEventsAndMeetings().catch(console.error);