VSN-1965 : Individual prepared passenger validation implemented + correcting update process little imperfection + Updating the filtered search process to cover unvalidated prepared passengers only.
Validation Workflow, External Service Integration, and Search Logic Enhancements
This update introduces a complete overhaul of the prepared-passenger validation process, ensuring data consistency, proper interaction with the external user service, and reliable search behavior. It also includes structural refactoring, transactional safety improvements, and precise specification definitions.
1. Data Consistency and Update Flow
Feature: Flush Deletions Before Insertions
- Implemented logic to force deletion operations to flush before any subsequent insert actions.
- This ensures that the database remains consistent and avoids conflicts or outdated references during update operations.
2. Validation Process Foundations
Feature: Initial Tested Version of Validation
- Introduced a basic, test-oriented implementation of the validation process.
- This early version is intended to validate the flow and structure of the passenger form output before fully enabling the complete validation mechanism.
3. External User Service Integration
Feature: External Paths Definition
- Defined new external API paths enabling communication with the user service.
- These endpoints allow transforming a prepared passenger into a validated passenger by invoking the external service.
Feature: External User Service
- Introduced a dedicated service abstraction for interacting with the user service.
- This clearly separates external communication from internal business logic.
Feature: Service Implementation
- Implemented the external user service, providing actual HTTP invocation logic and response handling.
Feature: User Service Invocation During Validation
- Integrated the external service call directly into the validation workflow.
- When a prepared passenger is validated, the system now communicates with the remote user service to finalize the validation process.
4. Transactional Safety
Feature: Transactional Validation Action
- Wrapped the entire validation process in a transactional boundary.
- Ensures that in case of any exception—whether from internal logic or external service communication—no partial or inconsistent database state is persisted.
- This guarantees atomicity and reinforces the integrity of the validation pipeline.
5. API and Code Structure Improvements
Refactor: Correcting External API Path
- Updated the external API path definition to reflect the accurate remote endpoint structure.
- Consolidated private utility methods into grouped sections inside the service implementation to improve code clarity and maintainability.
Refactor: External API URL Redefinition
- Adjusted the external endpoint URL after its centralization within the common project, ensuring alignment between microservices.
6. Validation Logic Corrections and Behavioral Changes
Refactor: Validation Logic Correction
- Ensured the validated passenger entity is saved immediately after its
validatedflag is updated. - Modified the passenger lookup logic to restrict searches exclusively to unvalidated prepared passengers.
- Introduced a dedicated JPQL query in the prepared passenger repository to efficiently retrieve unvalidated records.
7. Specifications and Search Enhancements
Feature: Validation Specification
- Added a new specification allowing filtering of prepared passengers based on the validated flag.
- Enables cleaner, specification-driven filtering instead of mixing validation logic inside controller or repository code.
Fix: Prepared Passenger Search
- Integrated the new validation specification into the filtered search criteria.
- Ensures that search results accurately reflect the new validation rules and that only relevant, non-validated prepared passengers appear in user queries.
8. Documentation
Documentation: Changelog Update
- Updated the project changelog to reflect the introduction of the validation workflow, external service integration, and search enhancements.
Closes VSN-1965