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): Complete Investigation case without ruling #17651

Merged
merged 39 commits into from
Feb 6, 2025

Conversation

unakb
Copy link
Member

@unakb unakb commented Jan 24, 2025

Máli lokið hjá héraðsdómi án undirritaðs úrskurðar (t.d. skýrslutaka)

What

Allow judges to complete investigation cases without submitting a ruling

Why

Because some cases don't require rulings and when that happens currently the judge has no way to close the case so that it moves out of the Active case list where it doesn't belong anymore.

Video

Screen.Recording.2025-01-23.at.14.09.48.mov

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 a new case status for cases completed without a ruling, refining appeal eligibility and notifications.
    • Added updated UI text and sections that clearly indicate when a case concludes without a ruling.
    • Expanded case type options to include new categories: "Statement from Minor" and "Statement in Court".
    • Enabled an option for adjusting the publication of appeal rulings.
    • Added a new checkbox for indicating whether a ruling is required in the ruling process.
  • Enhancements

    • Improved clarity in email notifications.
    • Streamlined workflows for case completion and investigation cases.
    • Enhanced user interface with conditional rendering based on case decisions.
    • Added support for displaying ruling dates and related information.
    • Introduced new message definitions for better localization of case statuses.

unakb and others added 11 commits January 22, 2025 13:45
* feat(j-s): Add new case decision for closing without ruling
* fix(j-s): tooltip with correct defender label

* fix(j-s): add new investigation types

* fix(j-s): format

* fix(j-s): revert unrelated changes

* fix(j-s): format
* feat(j-s): Handle complete case without ruling in UI

* Update case.ts

* Update SignedVerdictOverview.tsx

* Update 20250121143923-update-case.js

* fix(j-s): Minor clean up

* Update DateLabel.tsx

* Update Cases.tsx

* Update apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.tsx

Co-authored-by: Thórhildur Thorleiksdóttir <thorhildur@kolibri.is>

* chore: nx format:write update dirty files

* Update Ruling.tsx

---------

Co-authored-by: Thórhildur Thorleiksdóttir <thorhildur@kolibri.is>
Co-authored-by: andes-it <builders@andes.is>
…17631)

* feat(j-s): Handle complete case without ruling in UI

* Update case.ts

* Update SignedVerdictOverview.tsx

* Update 20250121143923-update-case.js

* fix(j-s): Minor clean up

* Update DateLabel.tsx

* feat(j-s): Add new notification strings

* chore(j-s): destructure sendEmail params to increase readability for multiple params

* feat(j-s): refactor email property logic to support completed without ruling cases

* Update Cases.tsx

* Update apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.tsx

Co-authored-by: Thórhildur Thorleiksdóttir <thorhildur@kolibri.is>

* chore: nx format:write update dirty files

* fix(j-s): add message to queue

* fix(j-s): small fixes

---------

Co-authored-by: unakb <una@kolibri.is>
Co-authored-by: andes-it <builders@andes.is>
@unakb unakb requested a review from a team as a code owner January 24, 2025 15:27
Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Walkthrough

The changes introduce a new case decision (COMPLETED_WITHOUT_RULING) across both backend and frontend. In the backend, modifications include updates to appeal eligibility logic, migrations to update enum values, and multiple email notification services refactoring to use object-based parameters. The court service mappings gain two new types, and several message definitions are added or updated in the UI for cases completed without a ruling. Additionally, new UI components and conditional rendering adjustments were implemented to reflect the revised case decision logic, with corresponding updates in constants, formatters, and GraphQL queries.

Changes

File(s) Change Summary
apps/judicial-system/api/.../case.transformer.ts Import of CaseDecision and update of getAppealInfo logic to check for COMPLETED_WITHOUT_RULING; refined appeal eligibility and appeal deadline calculations.
apps/judicial-system/backend/migrations/...-update-case.js (both files) Migration scripts updating PostgreSQL enum values for the decision and type columns, including adding COMPLETED_WITHOUT_RULING and new case types; rollback functionality provided.
apps/judicial-system/backend/src/app/messages/notifications.ts New message definitions under acceptedWithoutRuling for notifications when a case is completed without a ruling.
apps/judicial-system/backend/src/app/modules/.../case.service.ts
apps/judicial-system/backend/src/app/modules/notification/... (multiple files)
Refactoring of email notification methods: updated sendEmail signatures to use object destructuring, adjustments to method calls, and introduction of helper methods for constructing email properties.
apps/judicial-system/backend/src/app/modules/court/court.service.ts Added new mappings for STATEMENT_FROM_MINOR and STATEMENT_IN_COURT in the courtSubtypes object.
apps/judicial-system/web/messages/... and apps/judicial-system/web/src/components/...
apps/judicial-system/web/src/routes/...
apps/judicial-system/web/src/utils/titleForCase/...
UI and localization updates: new message definitions and sections for cases without a ruling, conditional rendering in components (e.g. ruling display, case title, PDF button state), new exports and components (e.g. DateLabel, updated RulingDateLabel), and GraphQL query adjustments.
libs/judicial-system/consts/..., libs/judicial-system/formatters/..., libs/judicial-system/types/... Updates to investigation case types: new case types (STATEMENT_FROM_MINOR, STATEMENT_IN_COURT), reinstatement of PHONE_TAPPING, and addition of COMPLETED_WITHOUT_RULING in the CaseDecision enum.
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql Updated the decision field declaration by adding a comment indicating an intention to regenerate its type.

Sequence Diagram(s)

sequenceDiagram
  participant CT as Case Transformer
  participant DB as Database / Enum Types
  Note over CT,DB: Appeal Information Calculation
  CT->>CT: Invoke getAppealInfo()
  CT-->>CT: Check case decision (COMPLETED_WITHOUT_RULING?)
  CT->>CT: Set flag (wasCompletedWithoutRuling)
  CT->>CT: Evaluate appeal eligibility for prosecutor & defender
  CT->>CT: Recalculate appealDeadline based on ruling date
Loading
sequenceDiagram
  participant UI as InvestigationCase UI
  participant Func as completeCaseWith()
  participant Srv as Case Service
  Note over UI,Func: Case Completion Flow
  UI->>Func: User action triggers completeCaseWith(action)
  Func->>Srv: Process case completion based on action ('signature' | 'noSignature' | 'modification')
  Srv-->>UI: Update case state, modal visibility, and PDF button status
Loading

Possibly Related PRs

  • fix(j-s): Only display cases with certain ruling decisions as up for review #15218: The changes in the main PR, which involve the introduction of the CaseDecision.COMPLETED_WITHOUT_RULING and its implications for appeal eligibility, are related to the modifications in the retrieved PR that filter cases based on their ruling decisions, including the handling of cases that do not meet certain criteria for review.
  • chore(j-s): Completed case notifications #14832: The changes in the main PR, which involve the introduction of a new CaseDecision type and modifications to the getAppealInfo function, are related to the updates in the retrieved PR that enhance notifications for completed cases, as both involve the handling of case decisions and their implications in the judicial system.
  • chore(j-s): Send signed court record to police for investigation cases #17196: The changes in the main PR, which involve modifying the getAppealInfo function and introducing the CaseDecision type, are related to the retrieved PR as both involve updates to the CaseService class, specifically with the handling of case decisions and messaging logic.

Suggested labels

automerge

Suggested reviewers

  • oddsson

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11f322b and d04f5aa.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/components/PageLayout/utils/index.spec.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/judicial-system/web/src/components/PageLayout/utils/index.spec.tsx

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 Jan 24, 2025

Codecov Report

Attention: Patch coverage is 28.00000% with 54 lines in your changes missing coverage. Please review.

Project coverage is 33.67%. Comparing base (1b76676) to head (6b04758).

Files with missing lines Patch % Lines
...rt/InvestigationCase/Confirmation/Confirmation.tsx 0.00% 23 Missing ⚠️
...verview/Components/CaseDocuments/CaseDocuments.tsx 0.00% 10 Missing ⚠️
...c/routes/Court/InvestigationCase/Ruling/Ruling.tsx 0.00% 5 Missing ⚠️
...-system/web/src/components/DateLabel/DateLabel.tsx 20.00% 4 Missing ⚠️
...ents/CaseTitleInfoAndTags/CaseTitleInfoAndTags.tsx 25.00% 3 Missing ⚠️
...nItems/RulingAccordionItem/RulingAccordionItem.tsx 0.00% 2 Missing ⚠️
...m/web/src/components/DateLabel/RulingDateLabel.tsx 33.33% 2 Missing ⚠️
...tem/web/src/components/RulingInput/RulingInput.tsx 33.33% 2 Missing ⚠️
...ystem/web/src/components/PageLayout/utils/index.ts 66.66% 1 Missing ⚠️
...icial-system/web/src/routes/Shared/Cases/Cases.tsx 75.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17651      +/-   ##
==========================================
- Coverage   33.69%   33.67%   -0.03%     
==========================================
  Files        6484     6485       +1     
  Lines      142322   142291      -31     
  Branches    41127    41105      -22     
==========================================
- Hits        47956    47912      -44     
- Misses      94366    94379      +13     
Flag Coverage Δ
judicial-system-api 20.33% <100.00%> (+0.11%) ⬆️
judicial-system-formatters 78.55% <100.00%> (+0.06%) ⬆️
judicial-system-message 66.16% <ø> (ø)
judicial-system-message-handler 47.72% <ø> (ø)
judicial-system-scheduler 71.05% <100.00%> (+0.06%) ⬆️
judicial-system-types 38.96% <100.00%> (+0.26%) ⬆️
judicial-system-web 27.86% <16.92%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
.../app/modules/case/interceptors/case.transformer.ts 100.00% <100.00%> (ø)
...l-system/backend/src/app/messages/notifications.ts 100.00% <ø> (ø)
...ystem/backend/src/app/modules/case/case.service.ts 88.90% <ø> (-0.02%) ⬇️
...tem/backend/src/app/modules/court/court.service.ts 39.73% <ø> (ø)
...p/modules/notification/baseNotification.service.ts 79.10% <ø> (-0.31%) ⬇️
...vices/caseNotification/caseNotification.service.ts 80.19% <ø> (+0.74%) ⬆️
...tNotification/civilClaimantNotification.service.ts 90.90% <ø> (ø)
...ndantNotification/defendantNotification.service.ts 82.14% <ø> (ø)
...Notification/indictmentCaseNotification.service.ts 93.22% <ø> (ø)
...ionNotification/institutionNotification.service.ts 90.69% <ø> (-0.22%) ⬇️
... and 26 more

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 1b76676...6b04758. Read the comment docs.

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

🧹 Nitpick comments (16)
apps/judicial-system/web/src/components/DateLabel/RulingDateLabel.strings.ts (1)

5-6: Consider retaining the date context in the default message.

By removing {ruledDate} from the default message, the label no longer indicates the date directly. If your new design displays the date through another component, this is fine. Otherwise, ensuring the user can see the date context directly in this label may improve clarity.

apps/judicial-system/web/src/components/DateLabel/RulingDateLabel.tsx (1)

7-9: Validate date prop types.

The rulingDate prop is typed as string. Consider allowing a Date type or validating/formatting the string to ensure correct date handling.

apps/judicial-system/web/src/components/DateLabel/DateLabel.tsx (2)

8-11: Use unified date handling to avoid confusion.

Accepting both string and Date for the date prop is flexible, but it can introduce confusion if the input is not always guaranteed to be a valid date. Consider standardizing on a single type or adding runtime validation.


17-20: Prevent extra spaces when no text is provided.

Currently, the template literal may produce surplus whitespace if text is empty. Consider trimming the final string or conditionally injecting spaces only when text is present.

-return `${text ?? ''} ${formattedDate} ${!hideTime ? formattedTime : ''}`
+const labelText = text ? `${text} ` : ''
+return `${labelText}${formattedDate}${!hideTime ? ` ${formattedTime}` : ''}`
apps/judicial-system/backend/migrations/20250121143923-update-case.js (1)

1-1: Remove redundant 'use strict'.

All ES modules are executed in strict mode by default. You can safely remove 'use strict'.

- 'use strict'
🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

apps/judicial-system/backend/migrations/20250122141848-update-case.js (1)

1-1: Remove redundant use of 'use strict'

Modern modules are in strict mode by default, making this directive unnecessary.

- 'use strict'
🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

apps/judicial-system/backend/src/app/modules/notification/services/institutionNotification/institutionNotification.service.ts (1)

78-83: Potential HTML injection risk
While constructing the html string, consider sanitizing or escaping body and tail if they can contain user-supplied data. This helps prevent HTML injection.

apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/Components/CaseDocuments/CaseDocuments.tsx (1)

147-169: Consider extracting conditional UI for readability.

Only showing this section when a ruling is required is logically correct. As a minor enhancement, you could extract this block into a smaller component for clarity and easier maintenance.

apps/judicial-system/backend/src/app/modules/notification/baseNotification.service.ts (1)

87-93: Introduce a dedicated interface for email parameters.

Defining a dedicated interface (e.g., SendEmailOptions) could offer more explicit typing and improve type reusability across the codebase.

apps/judicial-system/web/src/components/index.ts (1)

95-96: Confirm naming consistency for date labels.

Re-exporting RulingDateLabel and DateLabel side by side is fine, but ensure they have distinct usage contexts. Consider whether these two labels could be consolidated or if the naming clearly differentiates their purposes.

apps/judicial-system/api/src/app/modules/case/interceptors/case.transformer.ts (2)

77-79: Improve readability of wasCompletedWithoutRuling check.

Defining wasCompletedWithoutRuling is straightforward. If more decisions are added in the future, consider using a switch statement or a dedicated function for improved readability and maintainability.


101-106: Review duplication in appeal checks.

Both canProsecutorAppeal and canDefenderAppeal logic repeat the isAppealableDecision check. Consider consolidating these checks into a single utility function, reducing duplication and simplifying future enhancements.

apps/judicial-system/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.tsx (1)

100-115: Switch statement covers all possible actions
The switch statement is well-structured. Consider adding a default case or exhaustive checking with TypeScript to handle unexpected actions more robustly.

apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.tsx (2)

9-9: Use Next.js-specific router hook for consistency
Consider switching from the default import of next/router to the useRouter hook for a more idiomatic Next.js approach.


144-170: Preserve existing data when toggling “Completed without ruling”?
When the checkbox becomes unchecked, this code sets decision to null and rewrites the conclusion field. This can inadvertently discard any previously entered conclusion. If you want to preserve existing user input, consider storing the user’s conclusion in a temporary variable and restoring it if the user reverts the checkbox.

-              conclusion: formatMessage(
-                m.sections.completedWithoutRuling.conclusion,
-              ),
+              conclusion: target.checked
+                ? formatMessage(m.sections.completedWithoutRuling.conclusion)
+                : workingCase.conclusion ?? '',
apps/judicial-system/backend/src/app/modules/case/case.service.ts (1)

Line range hint 947-996: Consider renaming the notification type for COMPLETED_WITHOUT_RULING
Sending a CaseNotificationType.RULING for a case completed without a ruling could be confusing. You might enhance clarity by introducing a more specific notification type or message.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e806b37 and bbb9bea.

📒 Files selected for processing (40)
  • apps/judicial-system/api/src/app/modules/case/interceptors/case.transformer.ts (4 hunks)
  • apps/judicial-system/backend/migrations/20250121143923-update-case.js (1 hunks)
  • apps/judicial-system/backend/migrations/20250122141848-update-case.js (1 hunks)
  • apps/judicial-system/backend/src/app/messages/notifications.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/case.service.ts (3 hunks)
  • apps/judicial-system/backend/src/app/modules/court/court.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/baseNotification.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/services/caseNotification/caseNotification.service.ts (42 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/services/civilClaimantNotification/civilClaimantNotification.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/services/defendantNotification/defendantNotification.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/services/indictmentCaseNotification/indictmentCaseNotification.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/services/institutionNotification/institutionNotification.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/services/subpoenaNotification/subpoenaNotification.service.ts (1 hunks)
  • apps/judicial-system/web/messages/Core/rulingAccordion.ts (1 hunks)
  • apps/judicial-system/web/messages/Core/sections.ts (1 hunks)
  • apps/judicial-system/web/messages/InvestigationCases/Court/confirmation.ts (1 hunks)
  • apps/judicial-system/web/src/components/AccordionItems/RulingAccordionItem/RulingAccordionItem.tsx (2 hunks)
  • apps/judicial-system/web/src/components/CaseTitleInfoAndTags/CaseTitleInfoAndTags.strings.ts (1 hunks)
  • apps/judicial-system/web/src/components/CaseTitleInfoAndTags/CaseTitleInfoAndTags.tsx (2 hunks)
  • apps/judicial-system/web/src/components/DateLabel/DateLabel.tsx (1 hunks)
  • apps/judicial-system/web/src/components/DateLabel/RulingDateLabel.strings.ts (1 hunks)
  • apps/judicial-system/web/src/components/DateLabel/RulingDateLabel.tsx (1 hunks)
  • apps/judicial-system/web/src/components/PageLayout/utils/index.ts (1 hunks)
  • apps/judicial-system/web/src/components/RulingDateLabel/RulingDateLabel.tsx (0 hunks)
  • apps/judicial-system/web/src/components/RulingInput/RulingInput.tsx (2 hunks)
  • apps/judicial-system/web/src/components/index.ts (2 hunks)
  • apps/judicial-system/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.tsx (4 hunks)
  • apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.tsx (10 hunks)
  • apps/judicial-system/web/src/routes/Shared/AppealToCourtOfAppeals/AppealCaseFiles.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/AppealToCourtOfAppeals/AppealToCourtOfAppeals.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/Components/CaseDocuments/CaseDocuments.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/Shared/Statement/Statement.tsx (1 hunks)
  • apps/judicial-system/web/src/utils/titleForCase/titleForCase.strings.ts (1 hunks)
  • apps/judicial-system/web/src/utils/titleForCase/titleForCase.ts (1 hunks)
  • libs/judicial-system/consts/src/lib/consts.ts (2 hunks)
  • libs/judicial-system/formatters/src/lib/formatters.ts (1 hunks)
  • libs/judicial-system/types/src/lib/case.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • apps/judicial-system/web/src/components/RulingDateLabel/RulingDateLabel.tsx
🧰 Additional context used
📓 Path-based instructions (39)
apps/judicial-system/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.strings.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/web/src/components/CaseTitleInfoAndTags/CaseTitleInfoAndTags.strings.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/web/src/routes/Shared/Cases/Cases.tsx (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/web/src/components/PageLayout/utils/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/web/src/routes/Shared/Statement/Statement.tsx (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/web/messages/Core/sections.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/web/src/components/AccordionItems/RulingAccordionItem/RulingAccordionItem.tsx (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."
libs/judicial-system/types/src/lib/case.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."
apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/Components/CaseDocuments/CaseDocuments.tsx (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/web/src/components/DateLabel/RulingDateLabel.tsx (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/notification/services/institutionNotification/institutionNotification.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."
apps/judicial-system/web/src/utils/titleForCase/titleForCase.strings.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/web/src/components/DateLabel/RulingDateLabel.strings.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."
libs/judicial-system/formatters/src/lib/formatters.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."
apps/judicial-system/web/src/routes/Shared/AppealToCourtOfAppeals/AppealCaseFiles.tsx (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/migrations/20250121143923-update-case.js (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/web/src/components/CaseTitleInfoAndTags/CaseTitleInfoAndTags.tsx (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/web/messages/Core/rulingAccordion.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/api/src/app/modules/case/interceptors/case.transformer.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/notification/services/subpoenaNotification/subpoenaNotification.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."
apps/judicial-system/backend/src/app/modules/court/court.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."
apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.strings.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/notification/services/civilClaimantNotification/civilClaimantNotification.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."
apps/judicial-system/web/src/components/RulingInput/RulingInput.tsx (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/case/case.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."
apps/judicial-system/web/src/utils/titleForCase/titleForCase.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/web/src/components/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/modules/notification/services/caseNotification/caseNotification.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."
apps/judicial-system/web/messages/InvestigationCases/Court/confirmation.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/web/src/routes/Court/InvestigationCase/Ruling/Ruling.tsx (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/notification/baseNotification.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."
libs/judicial-system/consts/src/lib/consts.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."
apps/judicial-system/backend/src/app/messages/notifications.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/notification/services/indictmentCaseNotification/indictmentCaseNotification.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."
apps/judicial-system/web/src/components/DateLabel/DateLabel.tsx (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/migrations/20250122141848-update-case.js (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/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.tsx (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/notification/services/defendantNotification/defendantNotification.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."
apps/judicial-system/web/src/routes/Shared/AppealToCourtOfAppeals/AppealToCourtOfAppeals.tsx (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."
📓 Learnings (2)
apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx (3)
Learnt from: oddsson
PR: island-is/island.is#16939
File: apps/judicial-system/web/src/components/Table/PastCasesTable/PastCasesTable.tsx:126-131
Timestamp: 2024-11-19T21:47:09.093Z
Learning: The `CaseListEntry` interface in `@island.is/judicial-system-web/src/graphql/schema` includes the properties `isValidToDateInThePast`, `indictmentRulingDecision`, and `indictmentDecision`.
Learnt from: oddsson
PR: island-is/island.is#16939
File: apps/judicial-system/web/src/components/Table/PastCasesTable/PastCasesTable.tsx:136-139
Timestamp: 2024-11-20T10:15:04.980Z
Learning: The properties `isValidToDateInThePast`, `indictmentRulingDecision`, and `indictmentDecision` are defined in the `CaseListEntry` interface used in the `PastCasesTable` component.
Learnt from: gudjong
PR: island-is/island.is#16760
File: apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx:112-118
Timestamp: 2024-11-12T15:15:11.835Z
Learning: In `apps/judicial-system/web/src/routes/Prosecutor/components/CasesAwaitingConfirmationTable/CasesAwaitingConfirmationTable.tsx`, `apps/judicial-system/web/src/routes/Court/components/CasesAwaitingAssignmentTable/CasesAwaitingAssignmentTable.tsx`, and one instance in `apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx`, it's correct to pass only the `type` prop to `ColumnCaseType` without the `decision` and `parentCaseId` props.
apps/judicial-system/backend/src/app/modules/notification/services/subpoenaNotification/subpoenaNotification.service.ts (1)
Learnt from: oddsson
PR: island-is/island.is#16329
File: apps/judicial-system/backend/src/app/modules/notification/subpoenaNotification.service.ts:143-177
Timestamp: 2024-11-12T15:15:20.157Z
Learning: In `apps/judicial-system/backend/src/app/modules/notification/subpoenaNotification.service.ts`, the method `sendEmails` currently uses `Promise.all` for multiple recipients, and changing it to `Promise.allSettled` is considered for a future iteration.
🪛 Biome (1.9.4)
apps/judicial-system/backend/migrations/20250121143923-update-case.js

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

apps/judicial-system/backend/migrations/20250122141848-update-case.js

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

🔇 Additional comments (115)
apps/judicial-system/web/src/components/DateLabel/RulingDateLabel.tsx (2)

1-2: File and folder structure / NextJS consistency check.

Since this file resides under apps/judicial-system/web/src/components/DateLabel/, the organization looks consistent with the NextJS approach of grouping related components into directories. No immediate structural concerns here.


14-14: Propagate date string through a specialized parser.

While passing rulingDate directly is convenient, ensure that the date is in a valid format for consistent display, especially if your environment deals with different locales or time zones.

apps/judicial-system/backend/migrations/20250121143923-update-case.js (2)

5-21: Confirm potential non-breaking impact with existing data.

Adding the COMPLETED_WITHOUT_RULING enum is straightforward. Verify that existing rows with other decision values are unaffected and that no queries break.


23-37: Verify rollback compatibility.

Ensure that no cases in production use COMPLETED_WITHOUT_RULING when rolling back, as this migration will strip that enum value. Validate that necessary fallback handling is in place if rollback is ever needed.

apps/judicial-system/web/src/components/CaseTitleInfoAndTags/CaseTitleInfoAndTags.strings.ts (1)

30-34: New locale message looks good.
This addition follows the project's i18n pattern, consistently naming and structuring the message.

apps/judicial-system/web/src/components/RulingInput/RulingInput.tsx (3)

17-17: Optional disabled prop is well-introduced.
Declaring the prop as optional with a default value fits common React and TypeScript patterns.


20-25: Destructuring with default value is clear and maintainable.
Setting disabled = false helps prevent undefined behavior and makes usage clearer.


61-61: Prop passthrough to Input is correct.
Ensuring the disabled state is forwarded correctly enables conditional UI behavior for read-only contexts.

apps/judicial-system/web/src/components/PageLayout/utils/index.ts (1)

25-27: Explicitly handling COMPLETED_WITHOUT_RULING is consistent.
This condition helps differentiate outcome handling for investigation cases without a ruling, aligning with new case logic.

apps/judicial-system/web/src/utils/titleForCase/titleForCase.ts (1)

29-31: Refined logic for COMPLETED_WITHOUT_RULING is coherent.
The condition properly distinguishes investigation cases completed without a ruling from traditional accepted cases.

apps/judicial-system/web/messages/Core/rulingAccordion.ts (1)

49-56: Implementation is consistent with existing patterns

The newly introduced noRuling section aligns with the established structure of defineMessages. No issues found regarding naming consistency or message definitions.

apps/judicial-system/web/src/components/AccordionItems/RulingAccordionItem/RulingAccordionItem.tsx (2)

6-6: Ensure thorough testing coverage for the new decision type

You introduced CaseDecision and a corresponding condition. Verify that automated tests cover scenarios where workingCase.decision equals CaseDecision.COMPLETED_WITHOUT_RULING.


31-63: Conditional rendering logic looks good

The conditional rendering logic properly handles the new decision flow. This approach is clear, maintainable, and follows standard React patterns.

apps/judicial-system/backend/migrations/20250122141848-update-case.js (1)

3-77: Migration script looks correct

Your enum replacement logic is valid, and rollback functionality is provided. No further issues found.

apps/judicial-system/web/messages/InvestigationCases/Court/confirmation.ts (1)

23-28: Reevaluate adding code to a file marked for deletion

There is a TODO: Delete this file comment at the top. Confirm if this file is truly intended for removal or still required. Adding new messages to a deprecated file may introduce confusion later.

apps/judicial-system/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.strings.ts (1)

21-26: New message for case completion without ruling
The newly added message property seamlessly aligns with the existing structure and naming convention, maintaining consistency and clarity.

apps/judicial-system/web/src/utils/titleForCase/titleForCase.strings.ts (1)

27-32: Additional message for concluded investigation cases
This new entry follows the established patterns in the file and clearly indicates a case concluded without a ruling.

apps/judicial-system/web/src/components/CaseTitleInfoAndTags/CaseTitleInfoAndTags.tsx (3)

10-10: Fitting import for anticipated decision usage
Importing CaseDecision is appropriate and utilized correctly in the following lines.


15-16: Imports for conditional date labeling
Both DateLabel and RulingDateLabel are introduced for flexible rendering of dates, enhancing clarity and user experience.


39-47: Well-structured conditional rendering
Displaying DateLabel only when decision is COMPLETED_WITHOUT_RULING ensures clarity and consistency. No issues detected in the logic.

apps/judicial-system/backend/src/app/modules/notification/services/civilClaimantNotification/civilClaimantNotification.service.ts (1)

78-85: Use of named parameters enhances clarity.

Switching to named parameters in sendEmail improves readability and maintainability by clearly labeling each argument.

apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/Components/CaseDocuments/CaseDocuments.tsx (2)

82-84: Handle undefined decision checks for safety.

Using !== CaseDecision.COMPLETED_WITHOUT_RULING is a straightforward check, but consider verifying that workingCase.decision is always defined to avoid potential runtime issues.


145-145: Disabled property correctly reflects ruling requirement.

Disabling this button when isRulingRequired is false ensures users cannot proceed with a ruling where none is needed.

apps/judicial-system/backend/src/app/modules/notification/baseNotification.service.ts (1)

79-86: Named parameter object improves maintainability.

Shifting to an object parameter in sendEmail clarifies argument meanings and helps prevent positional errors.

apps/judicial-system/backend/src/app/modules/notification/services/indictmentCaseNotification/indictmentCaseNotification.service.ts (1)

63-70: Consistent object destructuring usage.

Passing parameters as an object aligns well with the overall refactoring, enhancing readability and consistency across services.

apps/judicial-system/web/src/routes/Shared/AppealToCourtOfAppeals/AppealToCourtOfAppeals.tsx (1)

25-25: Verify usage patterns for clarity and maintainability.

Introducing RequestAppealRulingNotToBePublishedCheckbox as an import here appears logically consistent with the rest of the component. No major NextJS best practice issues are apparent. However, confirm that its usage is clearly documented to assist future maintainers in understanding the rationale behind publishing or not publishing a ruling.

apps/judicial-system/web/src/routes/Shared/AppealToCourtOfAppeals/AppealCaseFiles.tsx (1)

26-27: Ensure consistency in newly added imports.

The addition of RequestAppealRulingNotToBePublishedCheckbox and RulingDateLabel suitably follows the established import pattern. Verify that both components are thoroughly tested and documented for consistent usage across the application.

apps/judicial-system/web/src/components/index.ts (1)

117-117: Check usage and test coverage for new checkbox export.

Exporting RequestAppealRulingNotToBePublishedCheckbox from here centralizes it in the shared components index, which is good for discoverability. Verify that any relevant unit tests are linked to this re-export and that usage contexts are consistent throughout the codebase.

apps/judicial-system/api/src/app/modules/case/interceptors/case.transformer.ts (3)

3-3: Validate new import alignment.

The inclusion of CaseDecision from @island.is/judicial-system/types is appropriate for the additional logic. This helps maintain consistent decision handling across the codebase.


58-58: Confirm decision defaults if undefined.

Relying on decision to determine case outcomes can lead to unexpected behavior if decision is undefined. Ensure downstream logic is guarded or that decision is guaranteed to be set before usage.


96-96: Ensure business logic consistency.

Setting canBeAppealed to false when the case is completed without ruling aligns with the new decision type. Just confirm that this behavior reflects real-world business rules for all scenario variants.

apps/judicial-system/web/src/routes/Shared/Statement/Statement.tsx (1)

26-26: Good introduction of the new checkbox import
No issues found with the new import. This addition aligns with the existing naming conventions and the usage below.

apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.strings.ts (1)

38-57: New localized messages for completed without ruling
These new messages are well-structured and follow the standard pattern for defineMessages. The IDs, default messages, and descriptions look consistent and clear.

apps/judicial-system/web/src/routes/Court/InvestigationCase/Confirmation/Confirmation.tsx (5)

95-97: Typed method parameter
Great use of a union type for the 'action' parameter. This strengthens maintainability and clarity in the code.


122-130: Conditional selection of 'noSignature' vs 'signature'
Smart approach to differentiate completion paths depending on 'COMPLETED_WITHOUT_RULING'. This code is concise and legible.


174-176: Disabling the PDF ruling for completed-without-ruling
Disabling the PDF button for COMPLETED_WITHOUT_RULING is logical, given that no ruling is created.


195-196: Separate continue button text
Nice clarity in the user interface by using a distinct button text for COMPLETED_WITHOUT_RULING.


225-225: Invoking completeCaseWith on modal continue
Good integration of the 'modification' action to handle scenarios with a corrected ruling.

apps/judicial-system/backend/src/app/modules/notification/services/defendantNotification/defendantNotification.service.ts (1)

65-72: Switch to object parameter for sending emails
This refactor improves clarity by consolidating parameters into a single object. Setting skipTail to true and attachments to undefined is explicit. No issues found.

libs/judicial-system/consts/src/lib/consts.ts (2)

34-36: Add new case type for "Brottvísun af heimili".
This addition aligns well with the rest of the enum mappings in this library. No issues found regarding reusability or bundling.


74-81: Add new case types for "Skýrslutaka brotaþola yngri en 18 ára" and "Skýrslutaka fyrir dómi".
These additions are consistent with the updated requirements, and the labels are clear.

apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx (2)

33-33: Importing 'CaseDecision' for newly introduced logic.
This import is necessary to handle the new decision state; usage looks correct.


174-178: Account for 'COMPLETED_WITHOUT_RULING' in the completion check.
Expanding the condition properly marks cases without a formal ruling as completed. This implementation is consistent with NextJS best practices and the PR’s objective.

libs/judicial-system/types/src/lib/case.ts (5)

27-27: Reintroduce 'PHONE_TAPPING' to the case types.
Check that wherever this value was used or removed, the references are now re-synced.


33-34: Add 'STATEMENT_FROM_MINOR' and 'STATEMENT_IN_COURT' to minor and court statements.
Consistent naming, no issues with reusability or type usage.


220-220: Add new 'COMPLETED_WITHOUT_RULING' decision value.
This thoroughly supports the PR’s objective to finalize investigations without a ruling.


342-342: Add 'COMPLETED_WITHOUT_RULING' to accepted case decisions.
Confirm that business logic for “accepted” decisions behaves as intended when no ruling exists.

✅ Verification successful

Business logic for COMPLETED_WITHOUT_RULING is properly implemented
The case decision is correctly handled throughout the codebase, including UI rendering, notifications, and case processing logic. The isAcceptingCaseDecision function properly includes this decision type.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify references to COMPLETED_WITHOUT_RULING to ensure consistent handling
rg 'COMPLETED_WITHOUT_RULING' -A 5

Length of output: 12744


Script:

#!/bin/bash
# Check implementation of isAcceptingCaseDecision
ast-grep --pattern 'export const isAcceptingCaseDecision = $_'

Length of output: 463


324-325: Include newly introduced case types in 'investigationCases'.
Ensure downstream logic accounts for these entries in queries or condition checks.

libs/judicial-system/formatters/src/lib/formatters.ts (1)

165-166: Add string labels for 'STATEMENT_FROM_MINOR' and 'STATEMENT_IN_COURT'.
This matches the case types from the types library. No typing or bundling concerns found.

apps/judicial-system/web/src/routes/Court/InvestigationCase/Ruling/Ruling.tsx (9)

116-117: Boolean naming clarity
isRulingRequired is set appropriately based on the case decision. However, if there are more conditions in the future, consider extracting this logic to a helper function or using a more descriptive variable naming if the condition grows.


208-209: Conditional requirement is consistent
Disabling and making the introduction field optional when a ruling is not required aligns with the intended workflow.


251-252: Matching pattern for “prosecutorDemands”
Similar to introduction, disabling and removing the required attribute for prosecutorDemands is consistent with the case completion logic.


296-297: “courtCaseFacts” logic
Disabling and removing requirement for “court case facts” is consistent with the new “without ruling” option.


344-345: “courtLegalArguments” optional
Correctly follows the pattern of disabling fields that are no longer needed if no ruling is required.


358-358: Disable RulingInput
This is correct, as no ruling input is needed if the decision is to complete the case without a ruling.


410-410: Disable Decision
The Decision component is irrelevant for a “completed without ruling” scenario, so this conditional disable is appropriate.


445-445: Check user flow
When disabled, any existing conclusion cannot be modified. Confirm whether this is acceptable if the user toggles away from the “completed without ruling” decision.


453-453: Prevent PDF generation
Disabling the PdfButton is logical because there is no ruling document to export.

apps/judicial-system/web/messages/Core/sections.ts (1)

425-430: New localization entry
The new message for cases concluded without a ruling is well-defined and consistent with the existing structure.

apps/judicial-system/backend/src/app/modules/court/court.service.ts (1)

115-116: Expanded subtype mappings
Adding STATEMENT_FROM_MINOR and STATEMENT_IN_COURT follows the established pattern in courtSubtypes. Love the clarity and consistency here.

apps/judicial-system/backend/src/app/messages/notifications.ts (1)

308-329: New notification messages
Introducing messages for cases accepted without a ruling is clear and accurately describes the scenario. This is a good localization approach.

apps/judicial-system/backend/src/app/modules/case/case.service.ts (1)

33-33: Importing new CaseDecision type
The new import aligns with the updated logic for cases completed without a ruling.

apps/judicial-system/backend/src/app/modules/notification/services/caseNotification/caseNotification.service.ts (52)

298-305: New object-based email parameters
The shift to destructured arguments is clear and more manageable. No issues detected.


327-332: Consistent destructured approach
This instance cleanly matches the updated email interface.


345-350: Use of getCourtEmail
Looks good. The destructured format is consistent with the rest of the codebase.


364-371: Defender email with skipTail
Ensuring we only append the tail for defenders with a national ID is logical.


525-531: Prosecutor email notification
All parameters are presented clearly; good to see the consistent pattern.


575-580: Email to prison
Straightforward destructuring; no issues found.


605-612: Calendar invite for defender
Adding the .then block is a nice touch to handle post-send steps. Implementation looks sound.


651-658: Defender court-date link
The object-based approach enhances readability.


711-726: Assigned official notification
Works well with the standard pattern.


872-891: New method for indictment ruling props
Encapsulating subject and HTML creation is a good pattern.


892-923: Refined logic for COMPLETED_WITHOUT_RULING
Conditionally adjusting emails for “no ruling” scenarios is clear.


924-936: Dispatching the correct email props
Nicely dispatches calls to the two specialized methods.


945-1002: Shared props for defender logic
Reusing shared HTML props is a neat approach. No immediate concerns.


1034-1039: Prison email for rulings
Parameters match the new object format.


1053-1058: Prison administration email
Implementation is consistent with the global emailing pattern.


1078-1083: Rejected custody email
Replicates the standard approach.


Line range hint 1180-1218: Defender modifications
Changing the email details for isolation vs. standard modifications is handled clearly.


1254-1259: Sending email to prison admin
Good use of destructuring. Maintains consistency.


1267-1272: Sending email to prison
Adheres to the established pattern.


1278-1283: Notification to prosecutor
Works as intended.


1289-1294: Notification to judge
Straightforward destructuring.


1300-1305: Notification to registrar
Naming matches the consistent approach in this file.


1358-1365: Revoked email to prison
Simple adaptation to destructured format.


1391-1398: Revoked email to defender
Skipping tail is appropriate when no national ID is present.


1428-1435: Revoked email for indictment case
Destructured arguments appear valid.


1518-1523: Sending revoked notification
Implementation aligns with the rest of the code.


1705-1712: Cannot update defendants at court
The object approach is used consistently here too.


1733-1738: Indictment denied
The destructured method call looks good.


1765-1770: Indictment returned
Maintains the new format.


1799-1806: Case files updated
Using recipientName: name and recipientEmail: email is consistent with the function signature.


1923-1928: Email to assigned role
No issues; code is straightforward.


1975-1980: Appeal to judge
Clean usage of destructured arguments.


1986-1991: Appeal to court
Every argument is well-defined.


1997-2002: Appeal to registrar
Again, matches the consistent approach.


2008-2013: Appeal to prosecutor
Implementation is correct.


2034-2041: Appeal to defender
Attachments set to undefined and skipTail condition are correct.


2096-2103: Appeal received - email to court of appeals
Logic is straightforward.


2118-2123: Email prosecutor upon appeal
All relevant fields are in place.


2143-2150: Email defender upon appeal
‘skipTail’ usage again is consistent and valid.


2195-2200: Appeal statement to assistant
No remarks; neatly matches the pattern.


2206-2211: Appeal statement to judge1
Destructured fields look accurate.


2217-2222: Appeal statement to judge2
All parameters set as intended.


2228-2233: Appeal statement to judge3
Still consistent with the new approach.


2251-2256: Appeal statement to prosecutor
Simple destructuring approach is correct.


2277-2284: Appeal statement to defender
Offers a route link only if a national ID is present. Works well.


2338-2343: Case files updated - court of appeal
The naming is unambiguous.


2360-2365: Case files updated - prosecutor
All destructured parameters are properly assigned.


2421-2432: Appeal completed - judge and prosecutor
Propagation of subject and body is standard.


2440-2447: Appeal completed - prison admin
Matches logic applied to other recipients.


2460-2465: Appeal completed - prison
No issues found; consistent usage.


2490-2497: Appeal completed - defender
Ensures the route link is accessible if there's a national ID.


2522-2535: Appeal discontinued
Both the prosecutor and defender are emailed with separate calls. Looks good.

apps/judicial-system/backend/src/app/modules/notification/services/subpoenaNotification/subpoenaNotification.service.ts (1)

70-77: Object-based email in subpoena service
Updating the call with object destructuring for readability is a valid approach. Consider migrating to Promise.allSettled() as per prior learning if partial failures need special handling.

@datadog-island-is
Copy link

Datadog Report

All test runs 40f39c1 🔗

8 Total Test Services: 0 Failed, 8 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.03%), 5 increased, 5 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-api 0 0 0 61 0 5.5s 1 increased (+0.1%) Link
judicial-system-formatters 0 0 0 40 0 5s 1 increased (+0.04%) Link
judicial-system-message 0 0 0 41 0 9.84s 1 no change Link
judicial-system-message-handler 0 0 0 4 0 3.22s 1 no change Link
judicial-system-scheduler 0 0 0 4 0 3.76s 1 increased (+0.06%) Link
judicial-system-types 0 0 0 23 0 5.93s 1 increased (+0.29%) Link
judicial-system-web 0 0 0 333 0 57.39s 1 decreased (-0.03%) Link
judicial-system-xrd-api 0 0 0 6 0 4.8s 1 increased (+0.06%) Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • judicial-system-web - jest 32.44% (-0.03%) - Details

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
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3227b and e137780.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/components/FormProvider/case.graphql (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/judicial-system/web/src/components/FormProvider/case.graphql (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."
📓 Learnings (1)
apps/judicial-system/web/src/components/FormProvider/case.graphql (1)
Learnt from: gudjong
PR: island-is/island.is#16863
File: apps/judicial-system/web/src/components/FormProvider/case.graphql:47-47
Timestamp: 2024-11-27T14:33:19.485Z
Learning: In the `Case` GraphQL query at `apps/judicial-system/web/src/components/FormProvider/case.graphql`, the `defendantId` field is not needed in the `subpoenas` object within the `mergedCases.defendants` array.
🔇 Additional comments (4)
apps/judicial-system/web/src/components/FormProvider/case.graphql (4)

112-121: Verify new case management fields for non-ruling investigations.
The addition of fields such as validToDate, isValidToDateInThePast, isCustodyIsolation, isolationToDate, and the subsequent fields (e.g. conclusion, endOfSessionBookings, etc.) supports the new functionality for completing investigation cases without a ruling. Please ensure that:

  • These fields are correctly defined in the GraphQL schema,
  • The backend resolvers are updated to supply proper data for them, and
  • Their naming and types are consistent with the rest of the schema.

204-207: Ensure proper backend support for additional case fields.
New fields like openedByDefender, defendantWaivesRightToCounsel, crimeScenes, and indictmentIntroduction have been incorporated to provide more nuanced case data for scenarios where a formal ruling isn’t submitted. Please verify that these fields are fully supported by the backend resolvers and that the data types match the schema definitions.


298-300: Review the "mergeCase" field integration.
The query now includes a nested mergeCase object. Confirm that its structure (e.g. including id and courtCaseNumber) correctly reflects the updated case relationship model and that the backend is prepared to return data in this format.


153-153: Check nested "decision" field consistency in parentCase.
Within the parentCase selection (line 153), the field decision still appears even though the main (root) case query now has this field removed (or commented out). Ensure that this discrepancy is intentional—if the nested case must return a decision field, it should be clearly documented to avoid client-side confusion.

@unakb unakb added skip-nx-cache Skip NX's cache in a pull request and removed skip-nx-cache Skip NX's cache in a pull request labels Feb 4, 2025
@unakb unakb disabled auto-merge February 5, 2025 13:30
@unakb unakb added the skip-nx-cache Skip NX's cache in a pull request label Feb 5, 2025
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

🧹 Nitpick comments (1)
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1)

26-26: Addition of Gender Field in Defendant Object

The introduction of the gender field enhances the defendant details in the cases query. Please ensure that all downstream components and client-side consumers of this data are updated to handle the new field appropriately.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75f3b0b and 11f322b.

📒 Files selected for processing (2)
  • apps/judicial-system/web/src/components/PageLayout/utils/index.spec.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/judicial-system/web/src/components/PageLayout/utils/index.spec.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`apps/**/*`: "Confirm that the code adheres to the following...

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/web/src/routes/Shared/Cases/cases.graphql
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: build (judicial-system-backend)
  • GitHub Check: build (judicial-system-api,judicial-system-digital-mailbox-api,judicial-system-message-handler,ju...
  • GitHub Check: linting (judicial-system-api,judicial-system-backend,judicial-system-web,judicial-system-consts,j...
  • GitHub Check: tests (judicial-system-backend)
  • GitHub Check: formatting
  • GitHub Check: tests (judicial-system-api,judicial-system-auth,judicial-system-consts,judicial-system-digital-ma...
  • GitHub Check: linting-workspace

@unakb unakb enabled auto-merge February 5, 2025 23:46
@unakb unakb removed the skip-nx-cache Skip NX's cache in a pull request label Feb 5, 2025
@unakb unakb added this pull request to the merge queue Feb 6, 2025
Merged via the queue into main with commit 125e472 Feb 6, 2025
32 checks passed
@unakb unakb deleted the j-s/case-completed-without-ruling branch February 6, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants