feat: add driver schedule self-service and full schedule support
This commit implements comprehensive driver schedule self-service functionality, allowing drivers to access their own schedules without requiring administrator permissions, along with full schedule support for multi-day views. Backend Changes: - Added /drivers/me/* endpoints for driver self-service operations: - GET /drivers/me - Get authenticated driver's profile - GET /drivers/me/schedule/ics - Export driver's own schedule as ICS - GET /drivers/me/schedule/pdf - Export driver's own schedule as PDF - POST /drivers/me/send-schedule - Send schedule to driver via Signal - PATCH /drivers/me - Update driver's own profile - Added fullSchedule parameter support to schedule export service: - Defaults to true (full upcoming schedule) - Pass fullSchedule=false for single-day view - Applied to ICS, PDF, and Signal message generation - Fixed route ordering in drivers.controller.ts: - Static routes (send-all-schedules) now come before :id routes - Prevents path matching issues - TypeScript improvements in copilot.service.ts: - Fixed type errors with proper null handling - Added explicit return types Frontend Changes: - Created MySchedule page with simplified driver-focused UI: - Preview PDF button - Opens schedule PDF in new browser tab - Send to Signal button - Sends schedule directly to driver's phone - Uses /drivers/me/* endpoints to avoid permission issues - No longer requires driver ID parameter - Resolved "Forbidden Resource" errors for driver role users: - Replaced /drivers/:id endpoints with /drivers/me endpoints - Drivers can now access their own data without admin permissions Key Features: 1. Full Schedule by Default - Drivers see all upcoming events, not just today 2. Self-Service Access - Drivers manage their own schedules independently 3. PDF Preview - Quick browser-based preview without downloading 4. Signal Integration - Direct schedule delivery to mobile devices 5. Role-Based Security - Proper CASL permissions for driver self-access This resolves the driver schedule access issue and provides a streamlined experience for drivers to view and share their schedules. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
3152
backend/src/copilot/copilot.service.ts
Normal file
3152
backend/src/copilot/copilot.service.ts
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user