VSN-1999 : Introducing validator email in the first phase validation process to track prepared passengers validators.
MR Description: Refactor – Validator Email Integration in First Phase Validation
Overview
This merge request introduces a series of refactors aimed at extending the first phase validation workflow for prepared passengers by incorporating the validator’s email address into the process. The validator email is now passed from the client request, propagated through the controller and service layer, and used inside the repository update operation.
The goal of this refactor is to improve traceability, auditing, and accountability by ensuring that each validation action captures the identity of the validating user. This enhancement also prepares the system for future reporting and compliance requirements.
Detailed Changes
1. Method Signature Refactor
- The method signature of the first phase validation logic was updated to include a new parameter:
validatorEmail. - This modification was applied both at the service interface level and the store type definition.
- The updated method now explicitly expects:
- A collection of prepared passenger identifiers.
- An email string representing the validator performing the action.
This change ensures that all layers of the validation flow are aware of and capable of transmitting this information.
2. Method Implementation Refactor
- The implementation of the service method was updated to handle the newly added
validatorEmailparameter. - The service now forwards the email to the repository update query.
- Internal validation and null-checking were updated to guarantee that the validator email is always captured properly.
- This update strengthens data completeness and aligns with new business requirements for audit-level detail.
3. JPQL Query Update
- The JPQL update query in the prepared passenger repository was modified to include the validator email update logic.
- The database now stores the validator’s email alongside the validation status when the first phase validation is executed.
- The query was carefully updated to ensure:
- No regression in existing behavior.
- Full support for batch updates.
- Minimal performance impact.
This ensures accurate traceability at the data persistence layer.
4. API Path Refactor
- The API path for first phase validation was updated to include a path variable capturing the validator’s email.
- This change reflects the new requirement that the client must explicitly send the email of the validating user.
- The endpoint contract has been updated to:
- Extract
validatorEmailfrom the URL. - Forward it directly to the controller method.
- Extract
This modification preserves endpoint consistency and keeps the contract explicit.
5. Invocation Logic Refactor
- The controller logic was updated to retrieve the validator email from the new path variable.
- The controller now passes the extracted email through to the service layer.
- Additional safety validations were put in place to ensure the email is available and correctly parsed.
This update ensures that the entire flow from API to database remains coherent and consistent.
6. Changelog Update
- The project’s changelog documentation was updated to reflect all modifications introduced in this refactor.
- The update includes:
- API path changes.
- New validator email parameter.
- Changes to query logic.
- Impacted components and internal methods.
Keeping this documentation up to date guarantees project transparency and supports future debugging or onboarding.
Benefits and Impact
- Improved Auditing: Each validation action now logs the validator’s identity in the database.
- Better Traceability: The system records who validated which passengers and when.
- Future-Proofing: Supports future features involving accountability, reporting dashboards, or detailed validation history.
- Cleaner Architecture: Method signatures, implementation, and repository queries now align with modern traceability standards.
- Explicit API Contracts: The updated path structure clarifies client responsibilities and strengthens request semantics.
Summary
This refactor enhances the first phase validation feature by integrating validator email tracking throughout the entire validation pipeline.
The following updates were introduced:
- Extended method signatures with
validatorEmail. - Updated service-layer implementation to propagate the email parameter.
- Refactored JPQL update query to store validator email in the database.
- Adjusted API paths to include validator email as a path variable.
- Updated invocation logic to retrieve the email from the URL and forward it to the service.
- Documented all changes in the project changelog.
This merge request significantly improves maintainability, traceability, and compliance readiness for the validation workflow.
Closes VSN-1999