Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(samgongustofa): Include operators and co-owners in validation + other minor fixes #17609

Merged

Conversation

johannaagma
Copy link
Member

@johannaagma johannaagma commented Jan 22, 2025

What

  • Include operators and coOwners when calling personCheck (validation)
  • Add required star to mileage field
  • Fix getSelectedVehicle, since the value findVehicle value is not saved in answers and is cleared on refresh
  • Make inputs coOwner email and phone red if failing validation

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced vehicle and machine selection logic across multiple templates
    • Improved form validation for vehicle-related fields
  • Bug Fixes

    • Updated path-based value retrieval for more robust data access
    • Added required validation for vehicle mileage input
  • Refactor

    • Standardized vehicle and machine selection methods
    • Improved error handling in co-owner form components
  • Style

    • Refined code structure for vehicle-related utility functions

@johannaagma johannaagma requested review from a team as code owners January 22, 2025 12:58
Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Walkthrough

The pull request introduces widespread modifications across multiple application templates and services, focusing on enhancing vehicle and machine detail retrieval. The primary change involves replacing direct property access with the getValueViaPath function, which provides more robust and flexible data extraction from nested object structures. Additionally, some forms now require vehicle mileage input and include improved error handling for co-owner fields.

Changes

File Path Change Summary
libs/application/template-api-modules/src/lib/modules/templates/energy-funds/energy-funds.service.ts Modified vehicle details retrieval using getValueViaPath
libs/application/templates/aosh/*/src/utils/getSelectedMachine.ts Updated machine selection logic with path-based value retrieval
libs/application/templates/*/src/utils/getSelectedVehicle.ts Enhanced vehicle selection with more specific path-based checks
libs/application/templates/transport-authority/*/src/forms/* Added required: true for vehicle mileage fields
libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/fields/CoOwner/index.tsx Introduced error handling for co-owner fields
libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx Updated setValue function to use dynamic field IDs
libs/clients/transport-authority/vehicle-owner-change/src/lib/vehicleOwnerChangeClient.service.ts Improved handling of operators and co-owners data

Possibly related PRs

Suggested Labels

automerge, deploy-feature

Suggested Reviewers

  • thordurhhh
  • sigruntg
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Project coverage is 35.53%. Comparing base (fa5f883) to head (61463f5).

Files with missing lines Patch % Lines
...change/src/lib/vehicleOwnerChangeClient.service.ts 0.00% 6 Missing ⚠️
.../lib/FindVehicleFormField/FindVehicleFormField.tsx 0.00% 3 Missing ⚠️
...les/templates/energy-funds/energy-funds.service.ts 0.00% 1 Missing ⚠️
...machine-supervisor/src/utils/getSelectedMachine.ts 0.00% 1 Missing ⚠️
...treet-registration/src/utils/getSelectedMachine.ts 0.00% 1 Missing ⚠️
...-machine-ownership/src/utils/getSelectedMachine.ts 0.00% 1 Missing ⚠️
...o-owner-of-vehicle/src/utils/getSelectedVehicle.ts 0.00% 1 Missing ⚠️
...perator-of-vehicle/src/utils/getSelectedVehicle.ts 0.00% 1 Missing ⚠️
...icle-license-plate/src/utils/getSelectedVehicle.ts 0.00% 1 Missing ⚠️
...-vehicle-ownership/src/utils/getSelectedVehicle.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17609      +/-   ##
==========================================
- Coverage   35.56%   35.53%   -0.03%     
==========================================
  Files        7033     7033              
  Lines      150624   150694      +70     
  Branches    43023    43045      +22     
==========================================
- Hits        53562    53554       -8     
- Misses      97062    97140      +78     
Flag Coverage Δ
application-template-api-modules 27.56% <0.00%> (+<0.01%) ⬆️
application-ui-shell 21.99% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...les/templates/energy-funds/energy-funds.service.ts 17.64% <0.00%> (ø)
...machine-supervisor/src/utils/getSelectedMachine.ts 22.22% <0.00%> (ø)
...treet-registration/src/utils/getSelectedMachine.ts 20.00% <0.00%> (ø)
...-machine-ownership/src/utils/getSelectedMachine.ts 22.22% <0.00%> (ø)
...o-owner-of-vehicle/src/utils/getSelectedVehicle.ts 13.33% <0.00%> (ø)
...perator-of-vehicle/src/utils/getSelectedVehicle.ts 13.33% <0.00%> (ø)
...icle-license-plate/src/utils/getSelectedVehicle.ts 20.00% <0.00%> (ø)
...-vehicle-ownership/src/utils/getSelectedVehicle.ts 13.33% <0.00%> (ø)
.../lib/FindVehicleFormField/FindVehicleFormField.tsx 2.09% <0.00%> (ø)
...change/src/lib/vehicleOwnerChangeClient.service.ts 14.51% <0.00%> (-1.56%) ⬇️

... and 14 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa5f883...61463f5. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 1ffab16 🔗

10 Total Test Services: 0 Failed, 10 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.8%), 4 increased, 195 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 63 0 22.34s N/A Link
air-discount-scheme-web 0 0 0 2 0 6.49s 1 no change Link
api 0 0 0 4 0 2.4s N/A Link
api-catalogue-services 0 0 0 23 0 7.07s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 16.43s N/A Link
api-domains-assets 0 0 0 3 0 9.57s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 10.22s 1 no change Link
api-domains-communications 0 0 0 5 0 32.78s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.02s N/A Link
api-domains-driving-license 0 0 0 23 0 27.32s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • message-queue - jest 67.46% (-0.8%) - Details

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (7)
libs/application/templates/energy-funds/src/utils/getSelectedVehicle.ts (1)

12-13: Consider handling potential undefined values for currentVehicleList.
If the external data is missing or malformed, currentVehicleList may be undefined and calling .vehicles.find(...) could cause a runtime error. Consider using optional chaining or verifying currentVehicleList is defined before accessing its vehicles array.

libs/application/templates/transport-authority/order-vehicle-registration-certificate/src/utils/getSelectedVehicle.ts (1)

9-11: Return handling for missing vehicle data.
Returning {} when no matching vehicle is found could lead to unexpected behavior if the calling code depends on specific vehicle properties. Consider returning undefined or a more explicit indicator when a vehicle is not found.

libs/application/templates/transport-authority/change-co-owner-of-vehicle/src/utils/getSelectedVehicle.ts (1)

9-11: Avoid mutating the currentVehicleList array directly.
The inline update to currentVehicleList.vehicles[index] can be replaced by creating a new updated array to maintain immutability, prevent unexpected side effects, and improve maintainability.

libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/utils/getSelectedVehicle.ts (1)

9-11: Use explicit boolean checks for clarity.

The new usage of getValueViaPath<boolean | undefined>(answers, 'pickVehicle.findVehicle') improves path-based retrieval. For added clarity, consider explicitly checking the boolean value (e.g., === true) to avoid inadvertently treating undefined as a falsy value.

libs/application/templates/transport-authority/change-operator-of-vehicle/src/utils/getSelectedVehicle.ts (1)

9-11: Maintain consistent boolean evaluation.

Similar to other files, ensure that the boolean check against getValueViaPath is explicit if you want to guard against undefined. This helps future maintainers avoid confusion about falsy comparisons.

libs/clients/transport-authority/vehicle-owner-change/src/lib/vehicleOwnerChangeClient.service.ts (1)

117-127: Replace null with empty arrays for operators/coOwners
Passing null might be acceptable if the API mandates it, but returning empty arrays often simplifies downstream handling. Confirm API expectations or consider returning empty arrays to avoid potential null checks.

operatorEmail:
  ownerChange.operators?.find((x) => x.isMainOperator)?.email || null,
operators:
- ownerChange.operators?.map((operator) => {...}) || null,
+ ownerChange.operators?.map((operator) => {...}) || [],
coOwners:
- ownerChange.coOwners?.map((coOwner) => {...}) || null,
+ ownerChange.coOwners?.map((coOwner) => {...}) || [],
libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx (1)

297-297: Consider refactoring repeated logic
You repeat the same setValue(\${field.id}.findVehicle`, true)operation in eachset*Values` function. Factor out a helper if this pattern grows or changes frequently to enhance maintainability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47ba3fc and 49074e5.

📒 Files selected for processing (18)
  • libs/application/template-api-modules/src/lib/modules/templates/energy-funds/energy-funds.service.ts (1 hunks)
  • libs/application/templates/aosh/change-machine-supervisor/src/utils/getSelectedMachine.ts (1 hunks)
  • libs/application/templates/aosh/deregister-machine/src/utils/getSelectedMachine.ts (1 hunks)
  • libs/application/templates/aosh/request-for-inspection/src/utils/getSelectedMachine.ts (1 hunks)
  • libs/application/templates/aosh/street-registration/src/utils/getSelectedMachine.ts (1 hunks)
  • libs/application/templates/aosh/transfer-of-machine-ownership/src/utils/getSelectedMachine.ts (1 hunks)
  • libs/application/templates/energy-funds/src/utils/getSelectedVehicle.ts (1 hunks)
  • libs/application/templates/transport-authority/change-co-owner-of-vehicle/src/forms/ChangeCoOwnerOfVehicleForm/InformationSection/vehicleSubSection.ts (1 hunks)
  • libs/application/templates/transport-authority/change-co-owner-of-vehicle/src/utils/getSelectedVehicle.ts (1 hunks)
  • libs/application/templates/transport-authority/change-operator-of-vehicle/src/forms/ChangeOperatorOfVehicleForm/InformationSection/vehicleSubSection.ts (1 hunks)
  • libs/application/templates/transport-authority/change-operator-of-vehicle/src/utils/getSelectedVehicle.ts (1 hunks)
  • libs/application/templates/transport-authority/order-vehicle-license-plate/src/utils/getSelectedVehicle.ts (1 hunks)
  • libs/application/templates/transport-authority/order-vehicle-registration-certificate/src/utils/getSelectedVehicle.ts (1 hunks)
  • libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/fields/CoOwner/index.tsx (3 hunks)
  • libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/forms/TransferOfVehicleOwnershipForm/InformationSection/vehicleSubSection.ts (1 hunks)
  • libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/utils/getSelectedVehicle.ts (1 hunks)
  • libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx (3 hunks)
  • libs/clients/transport-authority/vehicle-owner-change/src/lib/vehicleOwnerChangeClient.service.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (18)
libs/application/templates/aosh/change-machine-supervisor/src/utils/getSelectedMachine.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/order-vehicle-registration-certificate/src/utils/getSelectedVehicle.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/aosh/request-for-inspection/src/utils/getSelectedMachine.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/aosh/street-registration/src/utils/getSelectedMachine.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/change-co-owner-of-vehicle/src/utils/getSelectedVehicle.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/order-vehicle-license-plate/src/utils/getSelectedVehicle.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/change-co-owner-of-vehicle/src/forms/ChangeCoOwnerOfVehicleForm/InformationSection/vehicleSubSection.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/aosh/deregister-machine/src/utils/getSelectedMachine.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/utils/getSelectedVehicle.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/aosh/transfer-of-machine-ownership/src/utils/getSelectedMachine.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/change-operator-of-vehicle/src/forms/ChangeOperatorOfVehicleForm/InformationSection/vehicleSubSection.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/template-api-modules/src/lib/modules/templates/energy-funds/energy-funds.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/clients/transport-authority/vehicle-owner-change/src/lib/vehicleOwnerChangeClient.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/forms/TransferOfVehicleOwnershipForm/InformationSection/vehicleSubSection.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/fields/CoOwner/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/transport-authority/change-operator-of-vehicle/src/utils/getSelectedVehicle.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/energy-funds/src/utils/getSelectedVehicle.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🪛 Biome (1.9.4)
libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/fields/CoOwner/index.tsx

[error] 61-61: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

🔇 Additional comments (14)
libs/application/templates/aosh/change-machine-supervisor/src/utils/getSelectedMachine.ts (1)

10-12: Adopt consistent fallback handling for optional booleans.

The usage of getValueViaPath<boolean | undefined> is correct and aligned with the library’s typed approach for nested data retrieval. Consider confirming that machine.findVehicle is indeed a boolean in all cases, ensuring the if-statement logic is unambiguous. Otherwise, this looks good.

libs/application/templates/aosh/deregister-machine/src/utils/getSelectedMachine.ts (1)

10-12: Validate the boolean or undefined return type.

Relying on getValueViaPath<boolean | undefined> for checking machine.findVehicle is a solid approach that enhances type safety. The fallback behavior is clear if the value is undefined, but consider adding a comment or test to confirm this flow works as intended.

libs/application/templates/aosh/request-for-inspection/src/utils/getSelectedMachine.ts (1)

10-12: Ensure consistent usage throughout.

This update aligns with the broader effort to use getValueViaPath for nested properties. Keeping the data retrieval approach consistent across modules simplifies maintainability. The change is straightforward and appears correct.

libs/application/templates/aosh/transfer-of-machine-ownership/src/utils/getSelectedMachine.ts (1)

10-12: Check for undefined states.

Using getValueViaPath avoids direct property access and elegantly handles potential null or undefined states in answers. This appears consistent with other modules. Overall, the logic is sound and improves reliability.

libs/application/templates/transport-authority/order-vehicle-license-plate/src/utils/getSelectedVehicle.ts (1)

9-11: Good use of getValueViaPath for nested data retrieval.
This condition appropriately checks for the findVehicle flag within pickVehicle. The subsequent optional chaining on currentVehicleList?.vehicles also helps prevent runtime errors if external data is missing.

libs/application/templates/aosh/street-registration/src/utils/getSelectedMachine.ts (1)

16-16: Retain type safety when retrieving values.

Using getValueViaPath<boolean | undefined> increases type safety. Confirm that machine.findVehicle is indeed stored as a boolean to prevent unintentional type coercion and ensure reusability across NextJS apps.

libs/application/templates/transport-authority/change-operator-of-vehicle/src/forms/ChangeOperatorOfVehicleForm/InformationSection/vehicleSubSection.ts (1)

72-72: Good use of required validation for mileage.

Adding required: true correctly enforces mileage submission. This aligns with the indicated need for mandatory mileage input, improving both user feedback and data integrity.

libs/application/templates/transport-authority/change-co-owner-of-vehicle/src/forms/ChangeCoOwnerOfVehicleForm/InformationSection/vehicleSubSection.ts (1)

73-73: Enforce required mileage field
Adding required: true ensures mileage data is collected whenever needed. This aligns with the PR objective of uniformly enforcing mandatory mileage.

libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/fields/CoOwner/index.tsx (2)

3-3: Efficient path-based data retrieval
Good use of getErrorViaPath and getValueViaPath to dynamically retrieve nested error and value data.


20-20: Destructure errors for better validation
Destructuring errors allows passing them directly to the InputController. This keeps the component neat.

libs/application/template-api-modules/src/lib/modules/templates/energy-funds/energy-funds.service.ts (1)

167-170: Verify correct type usage for getValueViaPath
getValueViaPath<boolean | undefined> implies selectVehicle.findVehicle might be boolean. Confirm this matches actual data shape to avoid type mismatches.

✅ Verification successful

Type usage for getValueViaPath is correct
The type boolean | undefined for selectVehicle.findVehicle is used consistently across the codebase and follows a logical pattern where it acts as a flag indicating vehicle selection.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search usage of selectVehicle.findVehicle to confirm it's boolean or object.
rg -A 5 "selectVehicle\.findVehicle"

Length of output: 1433

libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx (2)

243-243: Confirm 'findVehicle' assignment validity
Setting the 'findVehicle' field to true unconditionally seems valid for the current context, but ensure that there is no scenario where a false value is needed to reset or revert the vehicle lookup status.


323-323: Maintain consistent approach to 'findVehicle'
This line is consistent with the logic in other setValues functions. Once verified that in all scenarios 'findVehicle' should be set to true, this approach looks correct.

libs/application/templates/transport-authority/transfer-of-vehicle-ownership/src/forms/TransferOfVehicleOwnershipForm/InformationSection/vehicleSubSection.ts (1)

93-93: Validate compulsory mileage field
Marking the mileage field as required ensures that the user must provide a value. Confirm that an appropriate validation message is displayed and tested so users understand why they need to enter the mileage.

@datadog-island-is
Copy link

datadog-island-is bot commented Jan 24, 2025

Datadog Report

All test runs 7fa897c 🔗

2 Total Test Services: 0 Failed, 2 Passed
⬆️ Test Sessions change in coverage: 1 increased (+0.01%), 21 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
application-template-api-modules 0 0 0 118 0 2m 5.12s 1 increased (+0.01%) Link
application-ui-shell 0 0 0 74 0 31.9s 1 no change Link

Copy link
Member

@norda-gunni norda-gunni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johannaagma johannaagma enabled auto-merge January 28, 2025 10:42
@johannaagma johannaagma added this pull request to the merge queue Jan 28, 2025
Merged via the queue into main with commit dde29c7 Jan 28, 2025
43 checks passed
@johannaagma johannaagma deleted the fix/samgongustofa-include-operators-and-coowners-in-validation branch January 28, 2025 23:39
robertaandersen pushed a commit that referenced this pull request Jan 29, 2025
…ther minor fixes (#17609)

* Include operators and coOwners when calling personCheck (validation)

* Add required star to mileage field

* Fix getSelectedVehicle since the value findVehicle is cleared on refresh (add findVehicle field into pickVehicle)

* Make inputs coOwner email and phone red if failing validation

* More fixes for findVehicle

* Cleanup
RunarVestmann pushed a commit that referenced this pull request Jan 29, 2025
…ther minor fixes (#17609)

* Include operators and coOwners when calling personCheck (validation)

* Add required star to mileage field

* Fix getSelectedVehicle since the value findVehicle is cleared on refresh (add findVehicle field into pickVehicle)

* Make inputs coOwner email and phone red if failing validation

* More fixes for findVehicle

* Cleanup
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.

3 participants