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(service-portal): Update get for documents #15112

Merged
merged 2 commits into from
Jun 5, 2024
Merged

Conversation

thordurhhh
Copy link
Member

@thordurhhh thordurhhh commented Jun 5, 2024

What

Update document list get

Why

No need for sending id

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

  • Refactor
    • Updated the document retrieval process to remove the nationalId parameter from various components and services. This change streamlines the handling of document lists and enhances data processing efficiency.

@thordurhhh thordurhhh added the automerge Merge this PR as soon as all checks pass label Jun 5, 2024
@thordurhhh thordurhhh requested a review from a team as a code owner June 5, 2024 13:54
Copy link
Contributor

coderabbitai bot commented Jun 5, 2024

Walkthrough

The changes primarily involve the removal of the nationalId field from various parts of the codebase. Specifically, the nationalId field was removed from the DocumentsInput class and the useDocumentList hook. Additionally, the getDocumentList method in the DocumentServiceV2 class now includes the nationalId in the categoryId parameter.

Changes

Files Change Summary
libs/api/domains/documents/src/lib/documentV2.service.ts Added nationalId to the getDocumentList method call, including it in the categoryId.
libs/api/domains/documents/src/lib/models/v2/documents.input.ts Removed the nationalId field and its decorators from the DocumentsInput class.
libs/service-portal/documents/src/hooks/useDocumentList.ts Removed the nationalId field from the fetchObject input in the useDocumentList hook.

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.

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

Outside diff range and nitpick comments (2)
libs/service-portal/documents/src/hooks/useDocumentList.ts (2)

Line range hint 56-56: Specify all dependencies in the useEffect hook to avoid potential bugs.

-  }, [loading, data, sendersAvailable, categoriesAvailable])
+  }, [loading, data, sendersAvailable, categoriesAvailable, setSendersAvailable, setCategoriesAvailable])

Line range hint 75-75: Update useEffect dependencies and remove unnecessary ones.

-  }, [pageSize, totalCount, loading])
+  }, [totalCount, loading, totalPages, setTotalPages])
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9e1ff00 and dd276be.

Files selected for processing (3)
  • libs/api/domains/documents/src/lib/documentV2.service.ts (1 hunks)
  • libs/api/domains/documents/src/lib/models/v2/documents.input.ts (1 hunks)
  • libs/service-portal/documents/src/hooks/useDocumentList.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • libs/api/domains/documents/src/lib/models/v2/documents.input.ts
Additional context used
Path-based instructions (2)
libs/service-portal/documents/src/hooks/useDocumentList.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/documents/src/lib/documentV2.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."
Biome
libs/service-portal/documents/src/hooks/useDocumentList.ts

[error] 56-56: This hook does not specify all of its dependencies: setCategoriesAvailable (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 56-56: This hook does not specify all of its dependencies: setSendersAvailable (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 75-75: This hook does not specify all of its dependencies: setTotalPages (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 75-75: This hook does not specify all of its dependencies: totalPages (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 75-75: This hook specifies more dependencies than necessary: pageSize (lint/correctness/useExhaustiveDependencies)

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

libs/api/domains/documents/src/lib/documentV2.service.ts

[error] 27-27: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 28-28: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

Additional comments not posted (1)
libs/api/domains/documents/src/lib/documentV2.service.ts (1)

111-111: Ensure the addition of nationalId aligns with the intended API changes and check for any potential security implications.

Verification successful

The addition of nationalId to the getDocumentList method in documentV2.service.ts appears to be consistent with its usage across the codebase. The relevant lines show that nationalId is being passed correctly in the method calls.

  • libs/clients/documents/src/lib/documentClient.ts: nationalId is a parameter in getDocumentList.
  • libs/api/domains/documents/src/lib/documentV1.service.ts: nationalId is passed to getDocumentList.
  • libs/api/domains/documents/src/lib/documentV2.service.ts: nationalId is included in the input object for getDocumentList.

No security implications or inconsistencies were found in the usage of nationalId.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `nationalId` in the `getDocumentList` method across the codebase.

# Test: Search for the method usage. Expect: Only occurances with the new parameter.
rg --type typescript $'getDocumentList'

Length of output: 73



Script:

#!/bin/bash
# Description: Verify the usage of `nationalId` in the `getDocumentList` method across the codebase.

# Test: Search for the method usage. Expect: Only occurrences with the new parameter.
rg --type ts 'getDocumentList'

Length of output: 910



Script:

#!/bin/bash
# Description: Extract lines around the usage of `getDocumentList` to verify the inclusion of `nationalId`.

# Extract lines from relevant files
rg --type ts -A 3 -B 3 'getDocumentList' libs/clients/documents/src/lib/documentClient.ts
rg --type ts -A 3 -B 3 'getDocumentList' libs/clients/documents-v2/src/lib/documentsClientV2.service.ts
rg --type ts -A 3 -B 3 'getDocumentList' libs/api/domains/finance/src/lib/api-domains-finance.resolver.ts
rg --type ts -A 3 -B 3 'getDocumentList' libs/api/domains/documents/src/lib/documentV1.service.ts
rg --type ts -A 3 -B 3 'getDocumentList' libs/api/domains/documents/src/lib/documentV2.service.ts

Length of output: 2027

@datadog-island-is
Copy link

datadog-island-is bot commented Jun 5, 2024

Datadog Report

All test runs f04e70d 🔗

21 Total Test Services: 0 Failed, 21 Passed
🔻 Test Sessions change in coverage: 2 decreased, 84 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-web 0 0 0 2 0 8.37s 1 no change Link
api 0 0 0 4 0 4.11s 1 no change Link
application-api-files 0 0 0 12 0 9.07s 1 no change Link
application-core 0 0 0 90 0 32.93s 1 decreased (-0.22%) Link
application-system-api 0 0 0 111 2 3m 14.55s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 53.4s 1 no change Link
application-templates-accident-notification 0 0 0 98 0 26.18s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 16.33s 1 no change Link
application-templates-driving-license 0 0 0 13 0 25.54s 1 no change Link
application-templates-example-payment 0 0 0 2 0 21.94s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • application-core - jest 78.58% (-0.22%) - Details
  • application-templates-parental-leave - jest 33.23% (-0.1%) - Details

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.10%. Comparing base (584cf9e) to head (dd276be).
Report is 2 commits behind head on main.

Current head dd276be differs from pull request most recent head a14b5f5

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

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15112      +/-   ##
==========================================
+ Coverage   37.05%   37.10%   +0.05%     
==========================================
  Files        6422     6415       -7     
  Lines      130847   130610     -237     
  Branches    37374    37295      -79     
==========================================
- Hits        48488    48467      -21     
+ Misses      82359    82143     -216     
Flag Coverage Δ
api 3.44% <ø> (ø)
services-auth-ids-api 55.16% <ø> (+0.09%) ⬆️

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

see 36 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 295da15...a14b5f5. Read the comment docs.

Copy link
Member

@jonbjarnio jonbjarnio left a comment

Choose a reason for hiding this comment

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

🚀

@kodiakhq kodiakhq bot merged commit cf9bd3d into main Jun 5, 2024
72 checks passed
@kodiakhq kodiakhq bot deleted the service-portal/doc-id-get branch June 5, 2024 16:50
sigruntg pushed a commit that referenced this pull request Jun 12, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
lodmfjord pushed a commit that referenced this pull request Jun 14, 2024
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.

2 participants