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(j-s): Create ruling confirmation #15894

Merged
merged 28 commits into from
Sep 10, 2024
Merged

feat(j-s): Create ruling confirmation #15894

merged 28 commits into from
Sep 10, 2024

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Sep 4, 2024

Create ruling confirmation

Asana

What

Add a confirmation stamp on rulings in S-cases when a case is completed.

Screenshots / Gifs

Screenshot 2024-09-05 at 14 05 02

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 PDF generation for legal documents, now supporting both indictment and ruling confirmations.
    • Introduced a new function for creating ruling confirmations.
  • Modifications

    • Updated existing functions to streamline the creation of confirmation PDFs based on document type.
    • Improved error handling during PDF creation for better reliability.
  • Refactor

    • Renamed functions to better reflect their purpose, improving clarity in the codebase.

Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

Walkthrough

The pull request introduces enhancements to the PDF generation functionality in the judicial system's backend. A new function, createRulingConfirmation, is added to support ruling confirmations alongside existing indictment confirmations. The createConfirmedPdf function is modified to differentiate between these two types based on the fileType parameter. Additionally, the FileService class is updated to accommodate the new PDF generation logic, allowing for improved handling of case files related to indictments and rulings.

Changes

File Path Change Summary
apps/judicial-system/backend/src/app/formatters/confirmedPdf.ts Added createRulingConfirmation function and modified createConfirmedPdf to handle both indictment and ruling confirmations based on fileType.
apps/judicial-system/backend/src/app/formatters/index.ts Renamed createConfirmedIndictment to createConfirmedPdf to better reflect functionality.
apps/judicial-system/backend/src/app/modules/file/file.service.ts Replaced createConfirmedIndictment with createConfirmedPdf, incorporating logic to handle different data for indictments and rulings based on file.category.

Possibly related PRs

  • fix(j-s): Indictment Appeal #15906: The changes in this PR involve modifications to the handling of indictment verdicts, which directly relates to the updates made in the main PR regarding the creation of PDFs for legal documents, specifically for indictments and rulings.
  • feat(id-card): updates to application #15870: This PR includes updates to the createConfirmedPdf function, which is directly connected to the changes in the main PR that enhance PDF generation for legal documents, including the handling of different types of confirmations.

Suggested labels

automerge


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

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 23.80952% with 64 lines in your changes missing coverage. Please review.

Project coverage is 36.80%. Comparing base (5d75f7b) to head (6de5730).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...-system/backend/src/app/formatters/confirmedPdf.ts 24.52% 40 Missing ⚠️
...ystem/backend/src/app/modules/file/file.service.ts 20.00% 24 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15894      +/-   ##
==========================================
- Coverage   36.80%   36.80%   -0.01%     
==========================================
  Files        6692     6692              
  Lines      137097   137152      +55     
  Branches    38971    38992      +21     
==========================================
+ Hits        50464    50478      +14     
- Misses      86633    86674      +41     
Flag Coverage Δ
judicial-system-backend 55.87% <23.80%> (-0.10%) ⬇️
web 1.85% <ø> (ø)

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

Files with missing lines Coverage Δ
...udicial-system/backend/src/app/formatters/index.ts 100.00% <100.00%> (ø)
...ystem/backend/src/app/modules/file/file.service.ts 69.62% <20.00%> (-5.38%) ⬇️
...-system/backend/src/app/formatters/confirmedPdf.ts 18.88% <24.52%> (ø)

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 5d75f7b...6de5730. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 4, 2024

Datadog Report

Branch report: j-s/confirmed-ruling
Commit report: 32a615d
Test service: judicial-system-backend

✅ 0 Failed, 21205 Passed, 0 Skipped, 18m 4.29s Total Time
🔻 Test Sessions change in coverage: 1 decreased (-0.09%)

🔻 Code Coverage Decreases vs Default Branch (1)

@oddsson oddsson changed the title J s/confirmed ruling feat(j-s): Create ruling confirmation Sep 5, 2024
@oddsson oddsson marked this pull request as ready for review September 9, 2024 10:54
@oddsson oddsson requested a review from a team as a code owner September 9, 2024 10:54
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, codebase verification and nitpick comments (1)
apps/judicial-system/backend/src/app/modules/file/file.service.ts (1)

Line range hint 185-265: Approve the updated logic in FileService but recommend enhancing error handling and logging.

The updates to the FileService class to handle both indictment and ruling categories are well-implemented. However, consider enhancing error handling and logging to ensure robustness and easier troubleshooting in production environments.

Consider implementing more comprehensive logging at key decision points within the new logic to aid in debugging and monitoring the system's behavior.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e3254de and 514f110.

Files selected for processing (3)
  • apps/judicial-system/backend/src/app/formatters/confirmedPdf.ts (6 hunks)
  • apps/judicial-system/backend/src/app/formatters/index.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/file/file.service.ts (4 hunks)
Additional context used
Path-based instructions (3)
apps/judicial-system/backend/src/app/formatters/index.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/backend/src/app/formatters/confirmedPdf.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/backend/src/app/modules/file/file.service.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (2)
apps/judicial-system/backend/src/app/formatters/index.ts (1)

37-37: Approve the renaming but verify usage across the codebase.

The renaming of createConfirmedIndictment to createConfirmedPdf is appropriate given the expanded functionality of the function. However, ensure that all references to the old function name are updated throughout the codebase to prevent any issues.

Run the following script to verify the function usage:

Verification successful

Renaming successfully verified.

The function createConfirmedPdf has been correctly renamed and updated across the codebase. There are no remaining references to the old function name createConfirmedIndictment, ensuring consistent functionality.

  • createConfirmedPdf is defined in confirmedPdf.ts.
  • It is correctly exported and used in file.service.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `createConfirmedPdf` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'createConfirmedPdf'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify all function calls to `createConfirmedPdf` in TypeScript files.

# Search for the function usage in TypeScript files.
rg --type ts -A 5 'createConfirmedPdf'

Length of output: 2788

apps/judicial-system/backend/src/app/formatters/confirmedPdf.ts (1)

333-348: Approve the update to createConfirmedPdf but verify handling of file types.

The update to createConfirmedPdf to handle both indictment and ruling confirmations is well-implemented. Ensure that the function correctly differentiates and handles the two types as expected.

Consider adding integration tests to verify that the function behaves correctly when handling different fileType parameters.

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 514f110 and dcd10f9.

Files selected for processing (1)
  • apps/judicial-system/backend/src/app/modules/file/file.service.ts (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/judicial-system/backend/src/app/modules/file/file.service.ts

Copy link
Member

@gudjong gudjong left a comment

Choose a reason for hiding this comment

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

One minor change needed to complete the PR.

@oddsson oddsson requested a review from gudjong September 9, 2024 20:34
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 dcd10f9 and e2a7d6a.

Files selected for processing (1)
  • apps/judicial-system/backend/src/app/modules/file/file.service.ts (4 hunks)
Additional context used
Path-based instructions (1)
apps/judicial-system/backend/src/app/modules/file/file.service.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (4)
apps/judicial-system/backend/src/app/modules/file/file.service.ts (4)

26-26: LGTM!

The import statement for isCompletedCase is correctly added to support the new functionality related to ruling confirmations.


185-219: LGTM!

The modifications to the confirmIndictmentCaseFile method to support both indictment and ruling categories are implemented correctly. The conditional logic for determining the appropriate parameters based on the file.category is sound, and the error handling mechanism is appropriate.

The changes follow the existing coding style and conventions and are self-contained within the method, minimizing the impact on other parts of the codebase.


240-265: LGTM!

The modifications to the getCaseFileFromS3 method to handle both indictment and ruling categories are implemented correctly. The conditional checks for the case state and the retrieval of the confirmed indictment case object based on the file.category are logically sound.

The changes are consistent with the modifications made in the confirmIndictmentCaseFile method and follow the existing coding style and conventions. The impact on other parts of the codebase is minimal, as the changes are localized within the method.


401-404: LGTM!

The additional condition for the RULING category in the getCaseFileSignedUrlFromS3 method is implemented correctly. It checks if the file.category is RULING and if the case is completed, which is consistent with the changes made in other parts of the code.

The changes follow the existing coding style and conventions and are localized within the method, minimizing the impact on other parts of the codebase.

@gudjong gudjong added the automerge Merge this PR as soon as all checks pass label Sep 10, 2024
@kodiakhq kodiakhq bot merged commit 9b9610e into main Sep 10, 2024
33 checks passed
@kodiakhq kodiakhq bot deleted the j-s/confirmed-ruling branch September 10, 2024 23:01
@coderabbitai coderabbitai bot mentioned this pull request Sep 11, 2024
6 tasks
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
* Checkpoint

* Cleanup

* Rename

* Refactor

* Remove unused code

* Fix lint

* Create confirmed ruling

* Create confirmed ruling

* Make confirmation smaller

* Make confirmation smaller

* Use correct date

* Merge

* Refactor

* Refactor

* Cleanup

* Cleanup

* Check for completed cases

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 4, 2024
6 tasks
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