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(my-pages): add info and deadline text #16896

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

disaerna
Copy link
Member

@disaerna disaerna commented Nov 15, 2024

Law and order - Text

What

Replacing text with text coming from service

Why

Translations and gender issues

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

Release Notes

  • New Features

    • Enhanced subpoena information with additional properties: information and deadline.
    • Conditional rendering for displaying subpoena information based on availability.
  • Bug Fixes

    • Improved handling and display of error messages during data fetching.
  • Documentation

    • Updated API schema to include new mandatory fields for subpoenas.

These updates aim to provide users with more comprehensive and contextual information regarding subpoenas, enhancing the overall user experience.

@disaerna disaerna requested a review from a team as a code owner November 15, 2024 11:00
@disaerna disaerna added the automerge Merge this PR as soon as all checks pass label Nov 15, 2024
Copy link
Contributor

coderabbitai bot commented Nov 15, 2024

Walkthrough

The pull request introduces modifications to the LawAndOrderService, subpoena.model, and related components to enhance the handling of subpoena data. Key changes include the addition of new properties (information and deadline) in the getSubpoena method's returned data structure, updates to the Text class, and schema modifications in the OpenAPI specification. Additionally, the GraphQL query and the corresponding frontend component have been updated to reflect these changes, improving the contextual information displayed to users.

Changes

File Path Change Summary
libs/api/domains/law-and-order/src/lib/law-and-order.service.ts Updated getSubpoena method to include information and deadline in the returned Subpoena data.
libs/api/domains/law-and-order/src/models/subpoena.model.ts Modified Text class: removed intro, renamed claim to information, and added deadline.
libs/clients/judicial-system-sp/src/clientConfig.json Updated SubpoenaData schema: added subpoenaInfoText, subpoenaNotificationDeadline, and updated required fields.
libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.graphql Modified GetSubpoena query to include information and deadline in the texts object.
libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.tsx Enhanced conditional rendering for subpoena.texts?.information and added display for subpoena.texts?.deadline.

Possibly related PRs

Suggested reviewers

  • unakb
  • oddsson

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 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
Member

@thorkellmani thorkellmani left a comment

Choose a reason for hiding this comment

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

LGTM

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/api/domains/law-and-order/src/models/subpoena.model.ts (1)

17-18: Document the deadline field format and purpose

Consider adding a JSDoc comment to document:

  • The expected format of the deadline (e.g., ISO date string, localized date string)
  • The purpose of this field in the context of subpoenas
  @Field({ nullable: true })
+ /**
+  * The deadline text for the subpoena notification.
+  * @example "Response required by December 31, 2024"
+  */
  deadline?: string
libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.tsx (1)

137-142: LGTM! Consider adding TypeScript interfaces for better type safety.

The implementation correctly handles the text replacement with fallbacks, which aligns with the PR objectives. However, to improve type safety and maintainability, consider defining an interface for the texts object structure.

Add this interface at the top of the file:

interface SubpoenaTexts {
  description?: string;
  confirmation?: string;
  information?: string;
  deadline?: string;
}

Then update the component's type inference:

const subpoena = data?.lawAndOrderSubpoena as {
  texts?: SubpoenaTexts;
  // ... other properties
};
libs/api/domains/law-and-order/src/lib/law-and-order.service.ts (1)

Line range hint 1-207: Architecture maintains reusability across NextJS apps.

The service follows good practices for reusability:

  • Clear separation of concerns with dependency injection
  • Consistent error handling patterns
  • Type-safe interfaces for cross-app usage
  • Modular structure within the libs directory
libs/clients/judicial-system-sp/src/clientConfig.json (1)

453-454: New schema properties added - Breaking Change Alert

The addition of subpoenaInfoText and subpoenaNotificationDeadline properties aligns well with the PR objectives for handling translations. However, this is a breaking change that requires careful deployment planning.

Consider implementing versioning for the API (e.g., /v2) to maintain backward compatibility with existing clients during the transition period.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3a99c33 and 4c42eda.

📒 Files selected for processing (5)
  • libs/api/domains/law-and-order/src/lib/law-and-order.service.ts (1 hunks)
  • libs/api/domains/law-and-order/src/models/subpoena.model.ts (1 hunks)
  • libs/clients/judicial-system-sp/src/clientConfig.json (2 hunks)
  • libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.graphql (1 hunks)
  • libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
libs/api/domains/law-and-order/src/lib/law-and-order.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/law-and-order/src/models/subpoena.model.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/judicial-system-sp/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."
libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.graphql (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/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.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."
📓 Learnings (1)
libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.tsx (1)
Learnt from: unakb
PR: island-is/island.is#16393
File: apps/judicial-system/digital-mailbox-api/src/app/modules/cases/models/subpoena.response.ts:164-169
Timestamp: 2024-11-12T15:15:11.835Z
Learning: Ensure that suggested code changes in `subpoena.response.ts` are accurate and necessary, avoiding redundant suggestions.
🔇 Additional comments (5)
libs/portals/my-pages/law-and-order/src/screens/Subpoena/Subpoena.graphql (2)

24-25: LGTM! The new fields align with requirements.

The addition of information and deadline fields to the texts object follows GraphQL best practices and matches the PR objectives of updating text content.


24-25: Verify schema definitions for new fields.

Let's ensure the new fields are properly defined in the GraphQL schema.

libs/api/domains/law-and-order/src/models/subpoena.model.ts (2)

Line range hint 1-63: LGTM! The model changes follow TypeScript best practices

The changes maintain:

  • Proper TypeScript type definitions
  • Correct use of GraphQL decorators
  • Appropriate nullability annotations

15-16: Verify the impact of renaming 'claim' to 'information'

The field has been renamed from claim to information. Let's ensure all references are updated.

✅ Verification successful

Field rename from 'claim' to 'information' is safe to proceed

Based on the extensive search results, the field rename from claim to information in the Subpoena model is safe. While there are many references to "claim" in the codebase, they are in different contexts (e.g., civil claims, insurance claims) and not related to the Subpoena model in the law-and-order domain. No direct usages of the claim field were found in the law-and-order domain or related GraphQL operations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining references to the old field name 'claim'
# that might need updating after the rename to 'information'

echo "Searching for remaining references to 'claim'..."
rg -l "claim" --type ts

echo "Searching for GraphQL queries/mutations using the old field name..."
rg -l "claim.*{" --type graphql

Length of output: 13241


Script:

#!/bin/bash
# Let's search specifically in the law-and-order domain and related areas for 'claim' usage
# to better understand if the renaming impacts related code

# Search in the law-and-order domain
echo "Searching in law-and-order domain..."
rg -p "claim" "libs/api/domains/law-and-order" -A 2 -B 2

# Search for GraphQL type definitions and queries related to subpoena
echo -e "\nSearching for GraphQL files referencing subpoena..."
rg -p "subpoena" -g "*.graphql" -g "*.ts"

# Search for imports of the subpoena model
echo -e "\nSearching for imports of subpoena model..."
rg -p "from.*subpoena\.model" --type ts

Length of output: 35317


Script:

#!/bin/bash
# Let's search for GraphQL queries and mutations that might be using the 'claim' field
# in the law-and-order domain

echo "Searching for GraphQL operations in law-and-order domain..."
rg -p "query|mutation.*Subpoena.*{" libs/api/domains/law-and-order -A 5

# Also search for any direct references to the 'claim' field in the law-and-order domain
echo -e "\nSearching for 'claim' field references in law-and-order domain..."
rg -p "claim" libs/api/domains/law-and-order

Length of output: 518


Script:

#!/bin/bash
# Let's try a different approach to search for GraphQL operations and field usage

# Search for GraphQL operations in law-and-order domain
echo "Searching for GraphQL operations..."
rg "type Subpoena" libs/api/domains/law-and-order -A 10

# Search for resolver implementations
echo -e "\nSearching for resolver implementations..."
ast-grep --pattern 'class $_ implements $_ {
  $$$
  async $name($_, $_) {
    $$$
    subpoena
    $$$
  }
  $$$
}'

Length of output: 356

libs/api/domains/law-and-order/src/lib/law-and-order.service.ts (1)

165-166: LGTM! Verify the text content display.

The addition of information and deadline properties to the texts object is well-structured and aligns with the PR objectives of updating text content. The values are safely accessed from the null-checked subpoenaData object.

Let's verify the text content display in the frontend components:

✅ Verification successful

Text properties are properly used and displayed in the UI

The verification confirms that:

  • The text properties are correctly rendered in Subpoena.tsx component with proper fallback to default messages
  • The properties are properly typed in the API models (subpoena.response.ts)
  • The text content is localized with appropriate message definitions in messages.ts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find components that render these new text properties

# Search for components using these new text fields
rg -A 3 "subpoena.*texts\.(information|deadline)"

# Search for any potential translation keys related to these fields
rg "subpoena.*\.(information|deadline)" -g "*.json"

Length of output: 105


Script:

#!/bin/bash
# Let's try a broader search to understand the usage context

# Search for any references to subpoena texts or related properties
rg -A 5 "texts\.(information|deadline)" 

# Search for subpoena-related components
fd -e ts -e tsx . | xargs rg -l "subpoena"

# Search for any GraphQL fragments or queries using these fields
rg -A 3 "subpoenaInfoText|subpoenaNotificationDeadline"

Length of output: 11130

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.47%. Comparing base (a693022) to head (58f733c).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16896      +/-   ##
==========================================
+ Coverage   36.44%   36.47%   +0.02%     
==========================================
  Files        6853     6852       -1     
  Lines      143622   143618       -4     
  Branches    41000    41000              
==========================================
+ Hits        52347    52378      +31     
+ Misses      91275    91240      -35     
Flag Coverage Δ
api 3.34% <ø> (ø)
judicial-system-api 19.76% <ø> (ø)
judicial-system-backend 55.25% <ø> (ø)
judicial-system-formatters 79.26% <ø> (ø)
judicial-system-message 66.99% <ø> (ø)
judicial-system-message-handler 47.99% <ø> (ø)
judicial-system-scheduler 70.67% <ø> (ø)
judicial-system-types 43.58% <ø> (ø)
judicial-system-web 27.16% <ø> (ø)

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

see 10 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 a693022...58f733c. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 15, 2024

Datadog Report

All test runs 87e376c 🔗

10 Total Test Services: 0 Failed, 10 Passed
➡️ Test Sessions change in coverage: 17 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.67s 1 no change Link
judicial-system-api 0 0 0 59 0 7.41s 1 no change Link
judicial-system-backend 0 0 0 21112 0 22m 46.02s 1 no change Link
judicial-system-formatters 0 0 0 38 0 6.19s 1 no change Link
judicial-system-message 0 0 0 35 0 13.07s 1 no change Link
judicial-system-message-handler 0 0 0 4 0 4.24s 1 no change Link
judicial-system-scheduler 0 0 0 4 0 4.37s 1 no change Link
judicial-system-types 0 0 0 23 0 7.91s 1 no change Link
judicial-system-web 0 0 0 333 0 1m 12.85s 1 no change Link
judicial-system-xrd-api 0 0 0 6 0 5.51s 1 no change Link

@kodiakhq kodiakhq bot merged commit b9cf31e into main Nov 15, 2024
49 checks passed
@kodiakhq kodiakhq bot deleted the my-pages/law-and-order-summon-text branch November 15, 2024 15:23
jonnigs pushed a commit that referenced this pull request Nov 26, 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