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

feat(application-dld): Entry requirements in DP #15430

Merged
merged 11 commits into from
Jul 4, 2024

Conversation

kksteini
Copy link
Member

@kksteini kksteini commented Jul 3, 2024

What?

Adding some safeguards against driving license duplicates being accessed by persons who are not eligible according to the criteria of having a sign number 400 or an expired, or soon to be expired, category on their driver's license.

TODO:

Possibly keep a list of Commercial / Heavy driver's licenses (ísl: meirapróf) for which categories to exclude in the expiry check.

Screenshots / Gifs

image

image

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

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
    • Introduced functionality to check eligibility for obtaining a new duplicate driving license.
  • Bug Fixes
    • Added specific error messages for driving license duplicate entry validation and expired category license errors.

Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Walkthrough

The updates introduce a new method canGetNewDuplicate to the DrivingLicenseService, enabling eligibility checks for obtaining a duplicate driving license. This method and its associated data type DrivinglicenseDuplicateValidityStatus are propagated to the DrivingLicenseDuplicateService, which now processes these checks and throws errors if necessary. Error messages specific to these scenarios are also added.

Changes

File Path Change Summary
libs/api/domains/driving-license/src/lib/drivingLicense.service.ts Added canGetNewDuplicate method for checking eligibility for duplicate licenses.
libs/api/domains/driving-license/src/lib/drivingLicense.type.ts Introduced DrivinglicenseDuplicateValidityStatus interface to describe eligibility status and metadata.
.../application/core/src/lib/messages.ts Added error messages for driving license duplicate entry validation and expired category license errors.
.../template-api-modules/src/lib/modules/templates/**/driving-license-duplicate.service.ts Integrated canGetNewDuplicate method within DrivingLicenseDuplicateService and included error handling.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@datadog-island-is
Copy link

datadog-island-is bot commented Jul 3, 2024

Datadog Report

All test runs 024e2a7 🔗

21 Total Test Services: 0 Failed, 20 Passed
🔻 Test Sessions change in coverage: 5 decreased, 2 increased, 78 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
api 0 0 0 4 0 2.82s 1 no change Link
api-domains-driving-license 0 0 0 23 0 30.82s 1 decreased (-0.8%) Link
api-domains-license-service 0 0 0 0 0 540.64ms 1 no change Link
application-api-files 0 0 0 12 0 6.32s 1 no change Link
application-core 0 0 0 90 0 20.32s 1 increased (+0.21%) Link
application-system-api 0 0 0 111 2 3m 28.82s 1 decreased (-0.11%) Link
application-template-api-modules 0 0 0 109 0 1m 51.28s 1 decreased (-0.13%) Link
application-templates-accident-notification 0 0 0 98 0 18.21s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 12.53s 1 no change Link
application-templates-driving-license 0 0 0 13 0 15.32s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (5)

  • api-domains-driving-license - jest 33.81% (-0.8%) - Details
  • clients-driving-license - jest 26.24% (-0.62%) - Details
  • license-api - jest 34.16% (-0.44%) - Details
  • application-template-api-modules - jest 25.6% (-0.13%) - Details
  • application-system-api - jest 37.32% (-0.11%) - Details

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 11.76471% with 15 lines in your changes missing coverage. Please review.

Project coverage is 36.94%. Comparing base (b15b54f) to head (97fa5eb).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15430      +/-   ##
==========================================
- Coverage   37.02%   36.94%   -0.09%     
==========================================
  Files        6540     6541       +1     
  Lines      133700   133776      +76     
  Branches    38249    38260      +11     
==========================================
- Hits        49498    49418      -80     
- Misses      84202    84358     +156     
Flag Coverage Δ
api 3.44% <ø> (ø)
api-domains-driving-license 44.50% <7.69%> (-0.19%) ⬇️
application-templates-accident-notification 19.93% <ø> (ø)
application-templates-car-recycling 4.23% <ø> (ø)
application-templates-criminal-record 22.35% <ø> (-0.03%) ⬇️
application-templates-driving-license 15.89% <ø> (-0.02%) ⬇️
application-templates-general-petition 19.05% <ø> (-0.03%) ⬇️
application-templates-health-insurance 23.46% <ø> (ø)
application-templates-inheritance-report 4.65% <ø> (-0.01%) ⬇️
application-templates-marriage-conditions 10.56% <ø> (ø)
application-templates-mortgage-certificate 45.14% <ø> (ø)
application-templates-parental-leave 28.46% <ø> (+0.11%) ⬆️
application-ui-components 1.43% <ø> (ø)
clients-driving-license 40.99% <ø> (ø)
clients-license-client 1.84% <ø> (ø)

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

Files Coverage Δ
...ins/driving-license/src/lib/drivingLicense.type.ts 100.00% <ø> (ø)
libs/application/core/src/lib/messages.ts 100.00% <ø> (ø)
...nse-duplicate/driving-license-duplicate.service.ts 46.15% <25.00%> (-3.85%) ⬇️
.../driving-license/src/lib/drivingLicense.service.ts 54.72% <7.69%> (-3.26%) ⬇️

... and 111 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 b18ac60...97fa5eb. Read the comment docs.

@kksteini kksteini marked this pull request as ready for review July 3, 2024 14:26
@kksteini kksteini requested a review from a team as a code owner July 3, 2024 14:26
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: 5

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ee2100d and eed72ae.

Files selected for processing (8)
  • libs/api/domains/driving-license/src/lib/drivingLicense.service.ts (2 hunks)
  • libs/api/domains/driving-license/src/lib/drivingLicense.type.ts (1 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/driving-license-duplicate/driving-license-duplicate.service.ts (2 hunks)
  • libs/application/templates/driving-license-duplicate/src/dataProviders/index.ts (2 hunks)
  • libs/application/templates/driving-license-duplicate/src/forms/applicationSections/sectionDataProviders.ts (2 hunks)
  • libs/application/templates/driving-license-duplicate/src/lib/drivingLicenseDuplicateTemplate.ts (2 hunks)
  • libs/clients/driving-license/src/lib/drivingLicenseApi.types.ts (1 hunks)
  • libs/clients/driving-license/src/v5/clientConfig.json (72 hunks)
Files not summarized due to errors (1)
  • libs/clients/driving-license/src/v5/clientConfig.json: Error: Message exceeds token limit
Files skipped from review due to trivial changes (1)
  • libs/application/templates/driving-license-duplicate/src/dataProviders/index.ts
Additional context used
Path-based instructions (7)
libs/application/templates/driving-license-duplicate/src/forms/applicationSections/sectionDataProviders.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/driving-license-duplicate/driving-license-duplicate.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/api/domains/driving-license/src/lib/drivingLicense.type.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/clients/driving-license/src/lib/drivingLicenseApi.types.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/driving-license-duplicate/src/lib/drivingLicenseDuplicateTemplate.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/api/domains/driving-license/src/lib/drivingLicense.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/clients/driving-license/src/v5/clientConfig.json (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."
Additional comments not posted (32)
libs/application/templates/driving-license-duplicate/src/forms/applicationSections/sectionDataProviders.ts (2)

14-17: Confirm the addition of DuplicateEligibilityApi.

The DuplicateEligibilityApi has been correctly imported and added to the list of data providers. Ensure that this API is correctly implemented and tested.


41-45: Ensure the DuplicateEligibilityApi data provider is functioning correctly.

The DuplicateEligibilityApi has been added to the list of data providers. Verify that this new data provider is functioning as expected and that it integrates smoothly with the rest of the application.

libs/application/template-api-modules/src/lib/modules/templates/driving-license-duplicate/driving-license-duplicate.service.ts (1)

23-38: Confirm the addition of the canGetNewDuplicate method.

The canGetNewDuplicate method has been correctly added to the DrivingLicenseDuplicateService class. Ensure that this method is thoroughly tested and that the error handling logic is robust.

libs/api/domains/driving-license/src/lib/drivingLicense.type.ts (1)

50-53: Confirm the addition of the DrivinglicenseDuplicateValidityStatus interface.

The DrivinglicenseDuplicateValidityStatus interface has been correctly added. Ensure that this interface is used consistently across the application and that it aligns with the expected response structure.

libs/clients/driving-license/src/lib/drivingLicenseApi.types.ts (1)

41-41: Confirm the addition of the comments field to the DriversLicense interface.

The comments field has been correctly added as an optional field. Ensure that this field is used appropriately and that any potential null values are handled correctly.

libs/application/templates/driving-license-duplicate/src/lib/drivingLicenseDuplicateTemplate.ts (2)

28-31: Confirm the addition of DuplicateEligibilityApi to the dependencies.

The DuplicateEligibilityApi has been correctly added to the list of dependencies in the DrivingLicenseDuplicateTemplate. Ensure that this API is correctly implemented and tested.


127-127: Ensure the DuplicateEligibilityApi dependency is functioning correctly.

The DuplicateEligibilityApi has been added to the list of dependencies. Verify that this new dependency is functioning as expected and that it integrates smoothly with the rest of the application.

libs/clients/driving-license/src/v5/clientConfig.json (25)

6-9: Ensure contact information is up-to-date.

The contact information provided should be verified for accuracy and updated if necessary.


22-24: LGTM!

The schema definition for the jwttoken header parameter is correct.


31-34: LGTM!

The schema definition for the api-version header parameter is correct.


41-44: LGTM!

The schema definition for the api-version query parameter is correct.


82-94: LGTM!

The schema definition for the 400 Bad Request response is correct.


111-113: LGTM!

The schema definition for the applicationId path parameter is correct.


120-123: LGTM!

The schema definition for the api-version header parameter is correct.


130-133: LGTM!

The schema definition for the api-version query parameter is correct.


161-173: LGTM!

The schema definition for the 400 Bad Request response is correct.


190-203: LGTM!

The schema definition for the api-version header and query parameters is correct.


213-231: LGTM!

The schema definition for the 200 Success response for a list of deprivations is correct.


249-262: LGTM!

The schema definition for the api-version header and query parameters is correct.


272-290: LGTM!

The schema definition for the 200 Success response for a list of categories is correct.


308-321: LGTM!

The schema definition for the api-version header and query parameters is correct.


367-380: LGTM!

The schema definition for the api-version header and query parameters is correct.


390-408: LGTM!

The schema definition for the 200 Success response for a list of districts is correct.


425-447: LGTM!

The schema definition for the jwttoken header and api-version header and query parameters is correct.


455-470: LGTM!

The schema definition for the 200 Success response for checking if a person has a quality marked photo is correct.


486-508: LGTM!

The schema definition for the jwttoken header and api-version header and query parameters is correct.


516-531: LGTM!

The schema definition for the 200 Success response for checking if a person has a quality marked signature is correct.


547-569: LGTM!

The schema definition for the jwttoken header and api-version header and query parameters is correct.


577-592: LGTM!

The schema definition for the 200 Success response for getting a quality marked photo is correct.


596-598: LGTM!

The schema definition for the 204 No Content response is correct.


611-633: LGTM!

The schema definition for the jwttoken header and api-version header and query parameters is correct.


641-656: LGTM!

The schema definition for the 200 Success response for getting a quality marked signature is correct.

@kksteini kksteini requested a review from a team as a code owner July 4, 2024 09:18
@kksteini kksteini added the automerge Merge this PR as soon as all checks pass label Jul 4, 2024
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between eed72ae and 9445d74.

Files selected for processing (4)
  • libs/api/domains/driving-license/src/lib/drivingLicense.service.ts (3 hunks)
  • libs/api/domains/driving-license/src/lib/drivingLicense.type.ts (1 hunks)
  • libs/application/core/src/lib/messages.ts (1 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/driving-license-duplicate/driving-license-duplicate.service.ts (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • libs/api/domains/driving-license/src/lib/drivingLicense.service.ts
  • libs/api/domains/driving-license/src/lib/drivingLicense.type.ts
  • libs/application/template-api-modules/src/lib/modules/templates/driving-license-duplicate/driving-license-duplicate.service.ts
Additional context used
Path-based instructions (1)
libs/application/core/src/lib/messages.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."
Additional comments not posted (2)
libs/application/core/src/lib/messages.ts (2)

504-508: Ensure message ID uniqueness and consistency.

The message ID for drivingLicenseDuplicateEntryValidationErrorTitle is unique and follows the naming convention. The default message and description are clear and consistent with existing messages.


515-520: Ensure message ID uniqueness and consistency.

The message ID for drivingLicenseDuplicateEntryValidationExpiredCategoryLicenseError is unique and follows the naming convention. The default message and description are clear and consistent with existing messages.

libs/application/core/src/lib/messages.ts Outdated Show resolved Hide resolved
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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9445d74 and a7052fb.

Files selected for processing (1)
  • libs/application/core/src/lib/messages.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/application/core/src/lib/messages.ts

@kodiakhq kodiakhq bot merged commit bd185f2 into main Jul 4, 2024
24 checks passed
@kodiakhq kodiakhq bot deleted the fix/dld-entry-requirements branch July 4, 2024 09:49
kksteini added a commit that referenced this pull request Jul 4, 2024
* feat(application-dld): Entry requirements in DP

* Cleanup

* Fix case

* Cleanup

* Responding to PR comments

* Fix duplicate id

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
oskarjs pushed a commit that referenced this pull request Aug 20, 2024
* feat(application-dld): Entry requirements in DP

* Cleanup

* Fix case

* Cleanup

* Responding to PR comments

* Fix duplicate id

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants