Files
vip-coordinator/frontend-old-20260125/dist/README-API.md
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

6.7 KiB

VIP Coordinator API Documentation

📚 Overview

This document provides comprehensive API documentation for the VIP Coordinator system using OpenAPI 3.0 (Swagger) specification. The API enables management of VIP transportation coordination, including flight tracking, driver management, and event scheduling.

🚀 Quick Start

View API Documentation

  1. Interactive Documentation (Recommended):

    # Open the interactive Swagger UI documentation
    open vip-coordinator/api-docs.html
    

    Or visit: file:///path/to/vip-coordinator/api-docs.html

  2. Raw OpenAPI Specification:

    # View the YAML specification file
    cat vip-coordinator/api-documentation.yaml
    

Test the API

The interactive documentation includes a "Try it out" feature that allows you to test endpoints directly:

  1. Open api-docs.html in your browser
  2. Click on any endpoint to expand it
  3. Click "Try it out" button
  4. Fill in parameters and request body
  5. Click "Execute" to make the API call

📋 API Categories

🏥 Health

  • GET /api/health - System health check

👥 VIPs

  • GET /api/vips - Get all VIPs
  • POST /api/vips - Create new VIP
  • PUT /api/vips/{id} - Update VIP
  • DELETE /api/vips/{id} - Delete VIP

🚗 Drivers

  • GET /api/drivers - Get all drivers
  • POST /api/drivers - Create new driver
  • PUT /api/drivers/{id} - Update driver
  • DELETE /api/drivers/{id} - Delete driver
  • GET /api/drivers/{driverId}/schedule - Get driver's schedule
  • POST /api/drivers/availability - Check driver availability
  • POST /api/drivers/{driverId}/conflicts - Check driver conflicts

✈️ Flights

  • GET /api/flights/{flightNumber} - Get flight information
  • POST /api/flights/{flightNumber}/track - Start flight tracking
  • DELETE /api/flights/{flightNumber}/track - Stop flight tracking
  • POST /api/flights/batch - Get multiple flights info
  • GET /api/flights/tracking/status - Get tracking status

📅 Schedule

  • GET /api/vips/{vipId}/schedule - Get VIP's schedule
  • POST /api/vips/{vipId}/schedule - Add event to schedule
  • PUT /api/vips/{vipId}/schedule/{eventId} - Update event
  • DELETE /api/vips/{vipId}/schedule/{eventId} - Delete event
  • PATCH /api/vips/{vipId}/schedule/{eventId}/status - Update event status

⚙️ Admin

  • POST /api/admin/authenticate - Admin authentication
  • GET /api/admin/settings - Get admin settings
  • POST /api/admin/settings - Update admin settings

💡 Example API Calls

Create a VIP with Flight

curl -X POST http://localhost:3000/api/vips \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "organization": "Tech Corp",
    "transportMode": "flight",
    "flights": [
      {
        "flightNumber": "UA1234",
        "flightDate": "2025-06-26",
        "segment": 1
      }
    ],
    "needsAirportPickup": true,
    "needsVenueTransport": true,
    "notes": "CEO - requires executive transport"
  }'

Add Event to VIP Schedule

curl -X POST http://localhost:3000/api/vips/{vipId}/schedule \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Meeting with CEO",
    "location": "Hyatt Regency Denver",
    "startTime": "2025-06-26T11:00:00",
    "endTime": "2025-06-26T12:30:00",
    "type": "meeting",
    "assignedDriverId": "1748780965562",
    "description": "Important strategic meeting"
  }'

Check Driver Availability

curl -X POST http://localhost:3000/api/drivers/availability \
  -H "Content-Type: application/json" \
  -d '{
    "startTime": "2025-06-26T11:00:00",
    "endTime": "2025-06-26T12:30:00",
    "location": "Denver Convention Center"
  }'

Get Flight Information

curl "http://localhost:3000/api/flights/UA1234?date=2025-06-26"

🔧 Tools for API Documentation

  • What it is: Interactive web-based API documentation
  • Features:
    • Try endpoints directly in browser
    • Auto-generated from OpenAPI spec
    • Beautiful, responsive interface
    • Request/response examples
  • Access: Open api-docs.html in your browser

2. OpenAPI Specification

  • What it is: Industry-standard API specification format
  • Features:
    • Machine-readable API definition
    • Can generate client SDKs
    • Supports validation and testing
    • Compatible with many tools
  • File: api-documentation.yaml

3. Alternative Tools

You can use the OpenAPI specification with other tools:

Postman

  1. Import api-documentation.yaml into Postman
  2. Automatically creates a collection with all endpoints
  3. Includes examples and validation

Insomnia

  1. Import the OpenAPI spec
  2. Generate requests automatically
  3. Built-in environment management

VS Code Extensions

  • OpenAPI (Swagger) Editor - Edit and preview API specs
  • REST Client - Test APIs directly in VS Code

📖 Documentation Best Practices

Why OpenAPI/Swagger?

  1. Industry Standard: Most widely adopted API documentation format
  2. Interactive: Users can test APIs directly in the documentation
  3. Code Generation: Can generate client libraries in multiple languages
  4. Validation: Ensures API requests/responses match specification
  5. Tooling: Extensive ecosystem of tools and integrations

Documentation Features

  • Comprehensive: All endpoints, parameters, and responses documented
  • Examples: Real-world examples for all operations
  • Schemas: Detailed data models with validation rules
  • Error Handling: Clear error response documentation
  • Authentication: Security requirements clearly specified

🔗 Integration Examples

Frontend Integration

// Example: Fetch VIPs in React
const fetchVips = async () => {
  const response = await fetch('/api/vips');
  const vips = await response.json();
  return vips;
};

Backend Integration

# Example: Using curl to test endpoints
curl -X GET http://localhost:3000/api/health
curl -X GET http://localhost:3000/api/vips
curl -X GET http://localhost:3000/api/drivers

🚀 Next Steps

  1. Explore the Interactive Docs: Open api-docs.html and try the endpoints
  2. Test with Real Data: Use the populated test data to explore functionality
  3. Build Integrations: Use the API specification to build client applications
  4. Extend the API: Add new endpoints following the established patterns

📞 Support

For questions about the API:

  • Review the interactive documentation
  • Check the OpenAPI specification for detailed schemas
  • Test endpoints using the "Try it out" feature
  • Refer to the example requests and responses

The API documentation is designed to be self-service and comprehensive, providing everything needed to integrate with the VIP Coordinator system.