Skip to content

fix(admin): Add UUID validation and improve error handling for boarding endpoints#14

Closed
Copilot wants to merge 1 commit into
azam/admin-onboardingfrom
copilot/sub-pr-13
Closed

fix(admin): Add UUID validation and improve error handling for boarding endpoints#14
Copilot wants to merge 1 commit into
azam/admin-onboardingfrom
copilot/sub-pr-13

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 21, 2026

Code review identified missing input validation and error handling gaps in the admin boarding/unboarding endpoints.

Changes

Backend Improvements

  • UUID validation: Added format validation for tripId, user_id, and cab_id parameters in both boarding endpoints to prevent SQL errors
  • Journey existence check: adminUnboardStudent now returns 404 when attempting to unboard a non-existent journey record
  • Documentation fixes:
    • Corrected route documentation to include missing journey_type parameter
    • Fixed typos in comments (jouneyjourney)
    • Clarified that unboarding works for both admin and driver-boarded students

Frontend Enhancement

  • Admin attribution UI: VehicleJourneyViewer now displays admin avatar and name for admin-boarded students instead of generic icon

Example

// Before: No UUID validation, successful response even when no journey exists
DELETE journeys WHERE trip_id = $1 AND user_id = $2
// Returns success: true even if rowCount = 0

// After: Validates UUIDs, checks deletion result
if (!uuidRegex.test(tripId)) {
  return res.status(400).json({ error: 'Invalid trip ID format' });
}
const result = await client.query('DELETE FROM journeys...');
if (result.rowCount === 0) {
  return res.status(404).json({ error: 'journey_not_found' });
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cab-management-system Ready Ready Preview, Comment Jan 21, 2026 1:42pm
cab-management-system-b59a Ready Ready Preview, Comment Jan 21, 2026 1:42pm

Copilot AI changed the title [WIP] Add admin boarding and unboarding functionality for students fix(admin): Add UUID validation and improve error handling for boarding endpoints Jan 21, 2026
Copilot AI requested a review from TheShahnawaaz January 21, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants