Files
vip-coordinator/frontend-old-20260125/src/utils/testVipData.ts
kyle 868f7efc23
Some checks failed
CI/CD Pipeline / Backend Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Tests (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
Major Enhancement: NestJS Migration + CASL Authorization + Error Handling
Complete rewrite from Express to NestJS with enterprise-grade features:

## Backend Improvements
- Migrated from Express to NestJS 11.0.1 with TypeScript
- Implemented Prisma ORM 7.3.0 for type-safe database access
- Added CASL authorization system replacing role-based guards
- Created global exception filters with structured logging
- Implemented Auth0 JWT authentication with Passport.js
- Added vehicle management with conflict detection
- Enhanced event scheduling with driver/vehicle assignment
- Comprehensive error handling and logging

## Frontend Improvements
- Upgraded to React 19.2.0 with Vite 7.2.4
- Implemented CASL-based permission system
- Added AbilityContext for declarative permissions
- Created ErrorHandler utility for consistent error messages
- Enhanced API client with request/response logging
- Added War Room (Command Center) dashboard
- Created VIP Schedule view with complete itineraries
- Implemented Vehicle Management UI
- Added mock data generators for testing (288 events across 20 VIPs)

## New Features
- Vehicle fleet management (types, capacity, status tracking)
- Complete 3-day Jamboree schedule generation
- Individual VIP schedule pages with PDF export (planned)
- Real-time War Room dashboard with auto-refresh
- Permission-based navigation filtering
- First user auto-approval as administrator

## Documentation
- Created CASL_AUTHORIZATION.md (comprehensive guide)
- Created ERROR_HANDLING.md (error handling patterns)
- Updated CLAUDE.md with new architecture
- Added migration guides and best practices

## Technical Debt Resolved
- Removed custom authentication in favor of Auth0
- Replaced role checks with CASL abilities
- Standardized error responses across API
- Implemented proper TypeScript typing
- Added comprehensive logging

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-31 08:50:25 +01:00

387 lines
13 KiB
TypeScript

// Test VIP data generation utilities
export const generateTestVips = () => {
const today = new Date();
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
const dayAfter = new Date(today);
dayAfter.setDate(dayAfter.getDate() + 2);
const formatDate = (date: Date) => date.toISOString().split('T')[0];
const formatDateTime = (date: Date) => {
const d = new Date(date);
d.setHours(14, 30, 0, 0); // 2:30 PM
return d.toISOString().slice(0, 16);
};
return [
// Admin Department VIPs (10)
{
name: 'Dr. Sarah Chen',
organization: 'Stanford University',
department: 'Admin',
transportMode: 'flight',
flights: [
{ flightNumber: 'UA1234', flightDate: formatDate(tomorrow), segment: 1 },
{ flightNumber: 'DL5678', flightDate: formatDate(tomorrow), segment: 2 }
],
needsAirportPickup: true,
needsVenueTransport: true,
notes: 'Vegetarian meals, requires wheelchair assistance'
},
{
name: 'Ambassador Michael Rodriguez',
organization: 'Embassy of Spain',
department: 'Admin',
transportMode: 'self-driving',
expectedArrival: formatDateTime(tomorrow),
needsVenueTransport: true,
notes: 'Security detail required, diplomatic immunity'
},
{
name: 'Prof. Aisha Patel',
organization: 'MIT Technology Review',
department: 'Admin',
transportMode: 'flight',
flights: [{ flightNumber: 'AA9876', flightDate: formatDate(dayAfter), segment: 1 }],
needsAirportPickup: true,
needsVenueTransport: false,
notes: 'Allergic to shellfish, prefers ground floor rooms'
},
{
name: 'CEO James Thompson',
organization: 'TechCorp Industries',
department: 'Admin',
transportMode: 'flight',
flights: [{ flightNumber: 'SW2468', flightDate: formatDate(tomorrow), segment: 1 }],
needsAirportPickup: false,
needsVenueTransport: true,
notes: 'Private jet arrival, has own security team'
},
{
name: 'Dr. Elena Volkov',
organization: 'Russian Academy of Sciences',
department: 'Admin',
transportMode: 'self-driving',
expectedArrival: formatDateTime(dayAfter),
needsVenueTransport: true,
notes: 'Interpreter required, kosher meals'
},
{
name: 'Minister David Kim',
organization: 'South Korean Ministry of Education',
department: 'Admin',
transportMode: 'flight',
flights: [
{ flightNumber: 'KE0123', flightDate: formatDate(tomorrow), segment: 1 },
{ flightNumber: 'UA7890', flightDate: formatDate(tomorrow), segment: 2 },
{ flightNumber: 'DL3456', flightDate: formatDate(tomorrow), segment: 3 }
],
needsAirportPickup: true,
needsVenueTransport: true,
notes: 'Long international flight, may need rest upon arrival'
},
{
name: 'Dr. Maria Santos',
organization: 'University of São Paulo',
department: 'Admin',
transportMode: 'flight',
flights: [{ flightNumber: 'LH4567', flightDate: formatDate(dayAfter), segment: 1 }],
needsAirportPickup: true,
needsVenueTransport: false,
notes: 'Speaks Portuguese and English, lactose intolerant'
},
{
name: 'Sheikh Ahmed Al-Rashid',
organization: 'UAE University',
department: 'Admin',
transportMode: 'self-driving',
expectedArrival: formatDateTime(tomorrow),
needsVenueTransport: true,
notes: 'Halal meals required, prayer room access needed'
},
{
name: 'Prof. Catherine Williams',
organization: 'Oxford University',
department: 'Admin',
transportMode: 'flight',
flights: [{ flightNumber: 'BA1357', flightDate: formatDate(tomorrow), segment: 1 }],
needsAirportPickup: false,
needsVenueTransport: true,
notes: 'Prefers tea over coffee, has mobility issues'
},
{
name: 'Dr. Hiroshi Tanaka',
organization: 'Tokyo Institute of Technology',
department: 'Admin',
transportMode: 'flight',
flights: [
{ flightNumber: 'NH0246', flightDate: formatDate(dayAfter), segment: 1 },
{ flightNumber: 'UA8642', flightDate: formatDate(dayAfter), segment: 2 }
],
needsAirportPickup: true,
needsVenueTransport: true,
notes: 'Jet lag concerns, prefers Japanese cuisine when available'
},
// Office of Development VIPs (10)
{
name: 'Ms. Jennifer Walsh',
organization: 'Walsh Foundation',
department: 'Office of Development',
transportMode: 'self-driving',
expectedArrival: formatDateTime(tomorrow),
needsVenueTransport: false,
notes: 'Major donor, prefers informal settings'
},
{
name: 'Mr. Robert Sterling',
organization: 'Sterling Philanthropies',
department: 'Office of Development',
transportMode: 'flight',
flights: [{ flightNumber: 'JB1122', flightDate: formatDate(tomorrow), segment: 1 }],
needsAirportPickup: true,
needsVenueTransport: true,
notes: 'Potential $10M donation, wine enthusiast'
},
{
name: 'Mrs. Elizabeth Hartwell',
organization: 'Hartwell Family Trust',
department: 'Office of Development',
transportMode: 'flight',
flights: [{ flightNumber: 'AS3344', flightDate: formatDate(dayAfter), segment: 1 }],
needsAirportPickup: false,
needsVenueTransport: true,
notes: 'Alumni donor, interested in scholarship programs'
},
{
name: 'Mr. Charles Montgomery',
organization: 'Montgomery Industries',
department: 'Office of Development',
transportMode: 'self-driving',
expectedArrival: formatDateTime(dayAfter),
needsVenueTransport: true,
notes: 'Corporate partnership opportunity, golf enthusiast'
},
{
name: 'Dr. Patricia Lee',
organization: 'Lee Medical Foundation',
department: 'Office of Development',
transportMode: 'flight',
flights: [
{ flightNumber: 'F91234', flightDate: formatDate(tomorrow), segment: 1 },
{ flightNumber: 'UA5555', flightDate: formatDate(tomorrow), segment: 2 }
],
needsAirportPickup: true,
needsVenueTransport: false,
notes: 'Medical research funding, diabetic dietary needs'
},
{
name: 'Mr. Thomas Anderson',
organization: 'Anderson Capital Group',
department: 'Office of Development',
transportMode: 'flight',
flights: [{ flightNumber: 'VX7788', flightDate: formatDate(tomorrow), segment: 1 }],
needsAirportPickup: true,
needsVenueTransport: true,
notes: 'Venture capital investor, tech startup focus'
},
{
name: 'Mrs. Grace Chen-Williams',
organization: 'Chen-Williams Foundation',
department: 'Office of Development',
transportMode: 'self-driving',
expectedArrival: formatDateTime(tomorrow),
needsVenueTransport: true,
notes: 'Arts and culture patron, vegan diet'
},
{
name: 'Mr. Daniel Foster',
organization: 'Foster Energy Solutions',
department: 'Office of Development',
transportMode: 'flight',
flights: [{ flightNumber: 'WN9999', flightDate: formatDate(dayAfter), segment: 1 }],
needsAirportPickup: false,
needsVenueTransport: false,
notes: 'Renewable energy focus, environmental sustainability'
},
{
name: 'Mrs. Victoria Blackstone',
organization: 'Blackstone Charitable Trust',
department: 'Office of Development',
transportMode: 'flight',
flights: [
{ flightNumber: 'B61111', flightDate: formatDate(dayAfter), segment: 1 },
{ flightNumber: 'AA2222', flightDate: formatDate(dayAfter), segment: 2 }
],
needsAirportPickup: true,
needsVenueTransport: true,
notes: 'Education advocate, prefers luxury accommodations'
},
{
name: 'Mr. Alexander Petrov',
organization: 'Petrov International Holdings',
department: 'Office of Development',
transportMode: 'self-driving',
expectedArrival: formatDateTime(dayAfter),
needsVenueTransport: true,
notes: 'International business, speaks Russian and English'
}
];
};
export const getTestOrganizations = () => [
'Stanford University', 'Embassy of Spain', 'MIT Technology Review', 'TechCorp Industries',
'Russian Academy of Sciences', 'South Korean Ministry of Education', 'University of São Paulo',
'UAE University', 'Oxford University', 'Tokyo Institute of Technology',
'Walsh Foundation', 'Sterling Philanthropies', 'Hartwell Family Trust', 'Montgomery Industries',
'Lee Medical Foundation', 'Anderson Capital Group', 'Chen-Williams Foundation',
'Foster Energy Solutions', 'Blackstone Charitable Trust', 'Petrov International Holdings'
];
// Generate realistic daily schedules for VIPs
export const generateVipSchedule = (department: string, transportMode: string) => {
const today = new Date();
const eventDate = new Date(today);
eventDate.setDate(eventDate.getDate() + 1); // Tomorrow
const formatDateTime = (hour: number, minute: number = 0) => {
const date = new Date(eventDate);
date.setHours(hour, minute, 0, 0);
return date.toISOString();
};
const baseSchedule = [
// Morning arrival and setup
{
title: transportMode === 'flight' ? 'Airport Pickup' : 'Arrival Check-in',
location: transportMode === 'flight' ? 'Airport Terminal' : 'Hotel Lobby',
startTime: formatDateTime(8, 0),
endTime: formatDateTime(9, 0),
description: transportMode === 'flight' ? 'Meet and greet at airport, transport to hotel' : 'Check-in and welcome briefing',
type: 'transport',
status: 'scheduled'
},
{
title: 'Welcome Breakfast',
location: 'Executive Dining Room',
startTime: formatDateTime(9, 0),
endTime: formatDateTime(10, 0),
description: 'Welcome breakfast with key stakeholders and orientation materials',
type: 'meal',
status: 'scheduled'
}
];
// Department-specific schedules
if (department === 'Admin') {
return [
...baseSchedule,
{
title: 'Academic Leadership Meeting',
location: 'Board Room A',
startTime: formatDateTime(10, 30),
endTime: formatDateTime(12, 0),
description: 'Strategic planning session with academic leadership team',
type: 'meeting',
status: 'scheduled'
},
{
title: 'Working Lunch',
location: 'Faculty Club',
startTime: formatDateTime(12, 0),
endTime: formatDateTime(13, 30),
description: 'Lunch meeting with department heads and key faculty',
type: 'meal',
status: 'scheduled'
},
{
title: 'Campus Tour',
location: 'Main Campus',
startTime: formatDateTime(14, 0),
endTime: formatDateTime(15, 30),
description: 'Guided tour of campus facilities and research centers',
type: 'event',
status: 'scheduled'
},
{
title: 'Research Presentation',
location: 'Auditorium B',
startTime: formatDateTime(16, 0),
endTime: formatDateTime(17, 30),
description: 'Presentation of current research initiatives and future plans',
type: 'meeting',
status: 'scheduled'
},
{
title: 'Reception Dinner',
location: 'University Club',
startTime: formatDateTime(19, 0),
endTime: formatDateTime(21, 0),
description: 'Formal dinner reception with university leadership',
type: 'event',
status: 'scheduled'
}
];
} else {
// Office of Development schedule
return [
...baseSchedule,
{
title: 'Donor Relations Meeting',
location: 'Development Office',
startTime: formatDateTime(10, 30),
endTime: formatDateTime(12, 0),
description: 'Private meeting with development team about giving opportunities',
type: 'meeting',
status: 'scheduled'
},
{
title: 'Scholarship Recipients Lunch',
location: 'Student Center',
startTime: formatDateTime(12, 0),
endTime: formatDateTime(13, 30),
description: 'Meet with current scholarship recipients and hear their stories',
type: 'meal',
status: 'scheduled'
},
{
title: 'Facility Naming Ceremony',
location: 'New Science Building',
startTime: formatDateTime(14, 0),
endTime: formatDateTime(15, 0),
description: 'Dedication ceremony for newly named facility',
type: 'event',
status: 'scheduled'
},
{
title: 'Impact Presentation',
location: 'Conference Room C',
startTime: formatDateTime(15, 30),
endTime: formatDateTime(16, 30),
description: 'Presentation on the impact of philanthropic giving',
type: 'meeting',
status: 'scheduled'
},
{
title: 'Private Dinner',
location: 'Presidents House',
startTime: formatDateTime(18, 30),
endTime: formatDateTime(20, 30),
description: 'Intimate dinner with university president and spouse',
type: 'meal',
status: 'scheduled'
},
{
title: 'Evening Cultural Event',
location: 'Arts Center',
startTime: formatDateTime(21, 0),
endTime: formatDateTime(22, 30),
description: 'Special performance by university arts programs',
type: 'event',
status: 'scheduled'
}
];
}
};