Skip to content

Resolve VSN-2080 "Feature/migrate passenger references from ID to UUID & remove unused functions"

Oussama Toumi a demandé de fusionner feature/VSN-2080 vers develop

Feature: Migration of Passenger Identification from ID to UUID & Cleanup of Temporary Trip Generation

This merge request completes the migration of passenger identification from numeric IDs (Long) to UUIDs (String) across the circuit service, and removes deprecated temporary trip generation functionality. The changes ensure consistency with external services, improve data integrity, and clean up legacy debug code from the codebase.

Scope of Changes

Data Transfer Objects (DTOs)

  • Removed passengerId (Long) field from AmendmentPassengerDTO, now exclusively using passengerUuid
  • Updated AddPassengerToCircuit request: changed passengersIds (List) to passengerUuids (List)
  • Removed user_id from PassengerDto and DestinationDto, standardizing on user_uuid
  • Updated CircuitInfoDTO and AddPointRequest to use UUID-based passenger references
  • Deleted TripDataBuilder.java: Removed temporary/debug class containing hardcoded test data for trip generation

Repository Layer

  • Refactored AmendmentPassengerRepository queries from passengerId to passengerUuid:
    • findFirstByPassengerIdOrderByStartDateDescCreatedAtDescfindFirstByPassengerUuidOrderByStartDateDescCreatedAtDesc
    • findByPassengerIdAndIsActiveTruefindByPassengerUuidAndIsActiveTrue
    • existsByPassengerIdAndIsActiveTrueexistsByPassengerUuidAndIsActiveTrue
    • findByPassengerIdfindByPassengerUuid
    • findByPassengerIdAndPeriodOverlapfindByPassengerUuidAndPeriodOverlap
  • Updated MongoDB query annotations to reference passengerUuid field

Service Layer

  • Refactored AmendmentPassengerService interface methods:
    • getAllAmendmentsByPassengerIdgetAllAmendmentsByPassengerUuid
    • getLastAmendmentByPassengerIdgetLastAmendmentByPassengerUuid
    • getActiveAmendmentByPassengerIdgetActiveAmendmentByPassengerUuid
    • getAmendmentByPassengerIdgetAmendmentByPassengerUuid
    • createAmendmentPassengers(List<Long>)createAmendmentPassengers(List<String>)
    • hasNoTripsForAutomaticAmendment(Long)hasNoTripsForAutomaticAmendment(String)
  • Added getPassengersByUuids(List<String>) method in UserService for bulk UUID lookups
  • Updated countPassengersWithPowerWheelchair to accept UUIDs instead of IDs
  • Removed from TripService:
    • generateTripsTemp(String circuitId) - temporary trip generation method
    • generateTrips(String circuitId) - associated trip generation method

Controller Layer

  • Removed deprecated ID-based endpoints from AmendmentPassengerController (7 endpoints removed)
  • Removed from TripController:
    • GET /generate-trips-tmp/{circuitId} - temporary trip generation endpoint
  • Retained and cleaned up UUID-based endpoints as the standard API

Path Constants

  • Removed GENERATE_TRIPS_TMP constant from TripPath.java

Mapper Updates

  • Updated AmendmentPassengerMapper, AmendmentCircuitMapper, CircuitMapper to handle UUID mappings
  • Refactored TripMapper, TripRecalculatorMapper, and AmendmentToTripAlgoMapper for UUID compatibility
  • Modified TripDriverAssignmentMapper to work with passenger UUIDs

External API Integration

  • Enhanced UserServiceImpl with UUID-based passenger retrieval logic
  • Updated TripAlgoServiceImpl to pass passenger UUIDs to algorithm service

Key Benefits

  • Consistency: Aligns passenger identification with external services using standardized UUIDs
  • Data Integrity: UUIDs provide globally unique identification, reducing collision risks
  • Simplified API: Removal of duplicate ID-based endpoints reduces API surface and maintenance burden
  • Code Cleanup: Removal of TripDataBuilder and temporary endpoints eliminates debug/test code from production
  • Future-Proof: UUID-based architecture supports distributed systems and cross-service references
  • Reduced Complexity: ~150 lines of code removed, cleaner codebase

Closes VSN-2080

Rapports de requête de fusion