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(citizenship): added busetuskilyrdi and nationality of children #14923

Merged
merged 4 commits into from
May 24, 2024

Conversation

berglindoma13
Copy link
Member

@berglindoma13 berglindoma13 commented May 24, 2024

...

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

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

    • Enhanced data retrieval and error reporting for citizenship applications.
    • Improved efficiency in processing applicant information.
  • Bug Fixes

    • Fixed issues related to residence condition checks and error handling.
  • Refactor

    • Refactored method signatures and data retrieval logic for better performance and maintainability.
  • Chores

    • Removed obsolete API declarations and unused components.
    • Updated interfaces and configurations to reflect new data requirements.

@berglindoma13 berglindoma13 requested a review from a team as a code owner May 24, 2024 13:01
Copy link
Contributor

coderabbitai bot commented May 24, 2024

Walkthrough

The changes primarily focus on refactoring and optimizing the CitizenshipService within the Directorate of Immigration module. This includes updating method signatures, enhancing error handling, and improving data retrieval efficiency. New interfaces and fields were added to support these changes. Additionally, the ResidenceConditionInfoApi was removed, and corresponding references were updated or eliminated across various files. The overall aim is to streamline the citizenship application process and improve data handling accuracy.

Changes

File Path Change Summary
libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/citizenship.service.ts Refactored method signatures, updated error handling, added new data retrieval calls, and improved data retrieval efficiency.
libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/types/index.ts Added new interfaces and updated ApplicantInformation interface with new fields.
libs/application/templates/directorate-of-immigration/citizenship/src/dataProviders/index.ts Removed ResidenceConditionInfoApi declaration.
libs/application/templates/directorate-of-immigration/citizenship/src/fields/index.ts Removed export of FormerIcelander.
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/FormerIcelanderSubSection.ts Updated the condition function and import statements to include new entities.
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/MaritalStatusSubSection.ts Refactored condition logic related to marital status and residence conditions.
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/ParentsSubSection.ts Modified condition logic to focus on marital status and residence conditions.
libs/application/templates/directorate-of-immigration/citizenship/src/forms/Prerequisites/index.ts Removed ResidenceConditionInfoApi from imports and usage.
libs/application/templates/directorate-of-immigration/citizenship/src/lib/CitizenshipTemplate.ts Removed ResidenceConditionInfoApi from imports.
libs/application/templates/directorate-of-immigration/citizenship/src/shared/constants.ts Removed getResidenceConditionInfo enum value from ApiActions.
libs/application/templates/directorate-of-immigration/citizenship/src/shared/types.ts Added ApplicantInformation interface extending ApplicantResidenceConditionViewModel.
libs/clients/directorate-of-immigration/src/clientConfig.json Added new boolean properties related to domicile, cohabitation, marriage, nationality, and parent-child relationships.
libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.service.ts Added nationality field to the constructed object.
libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.types.ts Added new optional citizenship field to CitizenshipApplication interface.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

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

Outside diff range and nitpick comments (4)
libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.service.ts (1)

Line range hint 145-145: Replace parseInt with Number.parseInt for consistency and clarity.

- countryId: parseInt(x.countryId),
+ countryId: Number.parseInt(x.countryId),

Apply this change to all instances where parseInt is used.

Also applies to: 151-151, 160-160, 298-298

libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/citizenship.service.ts (2)

Line range hint 224-224: Use strict equality checks (===) instead of loose equality (==).

- answers.countriesOfResidence?.hasLivedAbroad == YES
+ answers.countriesOfResidence?.hasLivedAbroad === YES

Apply this change to all instances where strict equality should be used.

Also applies to: 233-233, 243-243


Line range hint 323-323: Replace parseInt with Number.parseInt for consistency.

- passportTypeId: parseInt(applicantPassport.passportTypeId),
+ passportTypeId: Number.parseInt(applicantPassport.passportTypeId),

Apply this change to all instances where parseInt is used.

Also applies to: 369-369

libs/clients/directorate-of-immigration/src/clientConfig.json (1)

1942-1944: The addition of parentOfChild2SSN and parentOfChild2Name in StaticDataChildNewModel should be carefully documented to ensure clarity on their usage and relevance to the application's functionality.

Consider adding detailed comments or documentation regarding the use of these new properties to maintain code clarity and ease future maintenance.

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 38a0b33 and 6bcd6fb.
Files selected for processing (14)
  • libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/citizenship.service.ts (5 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/types/index.ts (2 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/dataProviders/index.ts (1 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/fields/index.ts (1 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/FormerIcelanderSubSection.ts (2 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/MaritalStatusSubSection.ts (1 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/ParentsSubSection.ts (1 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/forms/Prerequisites/index.ts (2 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/lib/CitizenshipTemplate.ts (2 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/shared/constants.ts (1 hunks)
  • libs/application/templates/directorate-of-immigration/citizenship/src/shared/types.ts (1 hunks)
  • libs/clients/directorate-of-immigration/src/clientConfig.json (5 hunks)
  • libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.service.ts (1 hunks)
  • libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.types.ts (1 hunks)
Files skipped from review due to trivial changes (4)
  • libs/application/templates/directorate-of-immigration/citizenship/src/dataProviders/index.ts
  • libs/application/templates/directorate-of-immigration/citizenship/src/fields/index.ts
  • libs/application/templates/directorate-of-immigration/citizenship/src/shared/constants.ts
  • libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.types.ts
Additional Context Used
Biome (37)
libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/citizenship.service.ts (13)

224-224: Use === instead of ==.
== is only allowed when comparing against null


233-233: Use === instead of ==.
== is only allowed when comparing against null


243-243: Use === instead of ==.
== is only allowed when comparing against null


1-2: All these imports are only used as types.


2-3: All these imports are only used as types.


4-12: Some named imports are only used as types.


13-17: Some named imports are only used as types.


17-25: All these imports are only used as types.


25-26: All these imports are only used as types.


27-28: All these imports are only used as types.


28-29: All these imports are only used as types.


323-323: Use Number.parseInt instead of the equivalent global.


369-369: Use Number.parseInt instead of the equivalent global.

libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/types/index.ts (1)

1-6: All these imports are only used as types.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/FormerIcelanderSubSection.ts (3)

9-10: Some named imports are only used as types.


10-11: All these imports are only used as types.


11-12: All these imports are only used as types.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/MaritalStatusSubSection.ts (3)

8-9: All these imports are only used as types.


11-15: All these imports are only used as types.


15-16: All these imports are only used as types.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/ParentsSubSection.ts (1)

8-9: All these imports are only used as types.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/Prerequisites/index.ts (1)

7-8: Some named imports are only used as types.

libs/application/templates/directorate-of-immigration/citizenship/src/lib/CitizenshipTemplate.ts (2)

1-12: Some named imports are only used as types.


18-19: Some named imports are only used as types.

libs/application/templates/directorate-of-immigration/citizenship/src/shared/types.ts (3)

1-6: All these imports are only used as types.


6-7: All these imports are only used as types.


7-8: All these imports are only used as types.

libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.service.ts (10)

183-183: Change to an optional chain.


192-194: Template literals are preferred over string concatenation.


198-200: Template literals are preferred over string concatenation.


1-1: Some named imports are only used as types.


1-2: All these imports are only used as types.


3-21: Some named imports are only used as types.


145-145: Use Number.parseInt instead of the equivalent global.


151-151: Use Number.parseInt instead of the equivalent global.


160-160: Use Number.parseInt instead of the equivalent global.


298-298: Use Number.parseInt instead of the equivalent global.

Path-based Instructions (10)
libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/types/index.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/directorate-of-immigration/citizenship/src/shared/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/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/ParentsSubSection.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/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/FormerIcelanderSubSection.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/directorate-of-immigration/citizenship/src/forms/Prerequisites/index.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/directorate-of-immigration/citizenship/src/lib/CitizenshipTemplate.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/directorate-of-immigration/src/lib/directorateOfImmigrationClient.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/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/MaritalStatusSubSection.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/directorate-of-immigration/citizenship/citizenship.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/directorate-of-immigration/src/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 (11)
libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/types/index.ts (1)

12-15: LGTM! The addition of new optional fields to ApplicantInformation aligns with the PR's objectives to enhance citizenship data handling.

libs/application/templates/directorate-of-immigration/citizenship/src/shared/types.ts (1)

15-20: LGTM! The extension of ApplicantInformation to include new boolean properties supports enhanced data handling for citizenship applications.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/ParentsSubSection.ts (1)

17-38: LGTM! The updated condition logic for displaying the parents subsection is well-implemented and aligns with the new requirements for residence condition checks.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/FormerIcelanderSubSection.ts (1)

17-49: LGTM! The updated condition logic for the FormerIcelander subsection is comprehensive and aligns with the enhanced data handling requirements.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/Prerequisites/index.ts (1)

Line range hint 1-86: LGTM! The configuration of the Prerequisites form is correctly set up with appropriate data providers and sections to support the citizenship application process.

libs/application/templates/directorate-of-immigration/citizenship/src/lib/CitizenshipTemplate.ts (1)

Line range hint 1-129: LGTM! The configuration of the Citizenship application template is comprehensive and well-structured, supporting the new features and requirements effectively.

libs/clients/directorate-of-immigration/src/lib/directorateOfImmigrationClient.service.ts (1)

313-313: Ensure the nationality field is correctly assigned and used.

This addition aligns with the PR's objective to handle the nationality of children in citizenship applications.

libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/InformationSection/MaritalStatusSubSection.ts (1)

16-16: Ensure the imported ApplicantInformation is used appropriately.

The usage of ApplicantInformation for form conditions enhances the clarity and maintainability of the code by centralizing the type definitions.

libs/application/template-api-modules/src/lib/modules/templates/directorate-of-immigration/citizenship/citizenship.service.ts (1)

41-43: Refactor getResidenceConditionInfo and getApplicantInformation to improve clarity and maintainability.

The refactoring of these methods aligns with the PR's objectives to enhance data retrieval and error handling.

Also applies to: 90-107

libs/clients/directorate-of-immigration/src/clientConfig.json (2)

1473-1481: The new boolean properties added to ApplicantResidenceConditionViewModel align with the PR's objectives to enhance data handling for citizenship applications. Ensure these properties are utilized correctly in the application logic.


1736-1739: The addition of new boolean properties in CitizenshipValidity schema is consistent with the PR's aim to handle new citizenship conditions. Verify that these properties are integrated properly across the application.

Verification successful

The new boolean properties isEESCitizen, eesNordicCitizen, eesResidenceCondition, and spouseIsCitizen are properly integrated across the application. They are referenced in service files, type definitions, and form components, indicating correct usage and integration.

  • clientConfig.json: Properties are defined.
  • citizenship.service.ts: Properties are used in application logic.
  • types/index.ts: Properties are included in type definitions.
  • shared/types.ts: Properties are included in shared type definitions.
  • ParentsSubSection.ts and MaritalStatusSubSection.ts: Properties are used in form components.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of new boolean properties in the CitizenshipValidity schema.

# Test: Search for the usage of new properties in the application code. Expect: Proper integration and usage.
rg --type json --type ts 'isEESCitizen|eesNordicCitizen|eesResidenceCondition|spouseIsCitizen'

Length of output: 3650

@datadog-island-is
Copy link

Datadog Report

All test runs ecc84c5 🔗

4 Total Test Services: 0 Failed, 4 Passed
➡️ Test Sessions change in coverage: 9 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 3.79s 1 no change Link
application-system-api 0 0 0 111 2 3m 32.08s 1 no change Link
application-template-api-modules 0 0 0 109 0 2m 30.63s 1 no change Link
application-ui-shell 0 0 0 74 0 1m 9.05s 1 no change Link

Copy link

codecov bot commented May 24, 2024

Codecov Report

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

Project coverage is 37.09%. Comparing base (38a0b33) to head (508c601).
Report is 1 commits behind head on main.

Current head 508c601 differs from pull request most recent head f1a9b28

Please upload reports for the commit f1a9b28 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14923      +/-   ##
==========================================
- Coverage   37.09%   37.09%   -0.01%     
==========================================
  Files        6353     6353              
  Lines      129378   129382       +4     
  Branches    36940    36939       -1     
==========================================
- Hits        47994    47992       -2     
- Misses      81384    81390       +6     
Flag Coverage Δ
api 3.48% <ø> (ø)
application-system-api 41.92% <0.00%> (-0.01%) ⬇️
application-template-api-modules 24.38% <0.00%> (-0.01%) ⬇️
application-ui-shell 21.73% <ø> (ø)

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

Files Coverage Δ
...immigration/citizenship/src/dataProviders/index.ts 100.00% <ø> (ø)
...gration/citizenship/src/lib/CitizenshipTemplate.ts 54.54% <ø> (ø)
...of-immigration/citizenship/src/shared/constants.ts 100.00% <ø> (ø)
.../src/lib/directorateOfImmigrationClient.service.ts 10.43% <ø> (ø)
...-of-immigration/citizenship/citizenship.service.ts 8.91% <0.00%> (-0.36%) ⬇️

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 c6dcf8f...f1a9b28. Read the comment docs.

Copy link
Member

@davidkef davidkef left a comment

Choose a reason for hiding this comment

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

lgtm

@berglindoma13 berglindoma13 added the automerge Merge this PR as soon as all checks pass label May 24, 2024
@kodiakhq kodiakhq bot merged commit 2a32a55 into main May 24, 2024
23 checks passed
@kodiakhq kodiakhq bot deleted the feat/citizenship-busetuskilyrdi branch May 24, 2024 14:24
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