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

chore(j-s): Add subpoena type to case table #15167

Closed
wants to merge 2 commits into from

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Jun 10, 2024

Add subpoena type to case table

Asana

What

Add a new field, subpoenaType to DB.

Why

This is a part of the new indictment cases flow we are creating.

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

    • Added a new subpoenaType field to cases, allowing users to specify the type of subpoena (e.g., ABSENCE, ARREST).
  • Database

    • Introduced a migration script to add a subpoena_type column to the case table.
  • GraphQL

    • Updated Case query and UpdateCase mutation to include the new subpoenaType field.

@oddsson oddsson requested a review from a team as a code owner June 10, 2024 13:48
Copy link
Contributor

coderabbitai bot commented Jun 10, 2024

Walkthrough

The recent updates introduce a new property subpoenaType to various parts of the judicial system application. This property, of type SubpoenaType, allows for specifying the type of subpoena in indictment cases. The changes span across multiple layers, including API, backend, and frontend, ensuring that the subpoenaType is consistently integrated into the system's data flow and user interface.

Changes

File(s) Change Summary
apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts Added subpoenaType property to UpdateCaseInput class.
apps/judicial-system/api/src/app/modules/case/models/case.model.ts Added SubpoenaType enum and subpoenaType field to Case class.
apps/judicial-system/backend/migrations/20240610131959-update-case.js Migration script to add subpoena_type column to case table.
apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts Added subpoenaType property to UpdateCaseDto class with validation.
apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts Added subpoenaType to districtCourtFields array.
apps/judicial-system/web/src/components/FormProvider/case.graphql Added subpoenaType field to Case query.
apps/judicial-system/web/src/utils/hooks/useCase/updateCase.graphql Added subpoenaType field to UpdateCase mutation.
libs/judicial-system/types/src/index.ts Exported SubpoenaType enum.
libs/judicial-system/types/src/lib/case.ts Added SubpoenaType enum with values ABSENCE and ARREST.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WebApp
    participant API
    participant Backend
    participant Database

    User->>WebApp: Update case with subpoenaType
    WebApp->>API: Send UpdateCase request with subpoenaType
    API->>Backend: Forward UpdateCase request
    Backend->>Database: Update case record with subpoenaType
    Database->>Backend: Confirmation of update
    Backend->>API: Confirmation of update
    API->>WebApp: Confirmation of update
    WebApp->>User: Update successful
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.

Project coverage is 37.02%. Comparing base (2d6481c) to head (7215834).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main   #15167    +/-   ##
========================================
  Coverage   37.01%   37.02%            
========================================
  Files        6423     6431     +8     
  Lines      131041   131161   +120     
  Branches    37523    37484    -39     
========================================
+ Hits        48511    48566    +55     
- Misses      82530    82595    +65     
Flag Coverage Δ
judicial-system-api 18.17% <44.44%> (+0.08%) ⬆️
judicial-system-backend 55.96% <100.00%> (+0.01%) ⬆️
judicial-system-formatters 81.38% <100.00%> (+0.09%) ⬆️
judicial-system-message 65.72% <ø> (ø)
judicial-system-types 49.53% <75.00%> (+0.19%) ⬆️
judicial-system-web 28.22% <ø> (ø)

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

Files Coverage Δ
...backend/src/app/modules/case/dto/updateCase.dto.ts 86.36% <100.00%> (+0.12%) ⬆️
.../backend/src/app/modules/case/guards/rolesRules.ts 59.09% <ø> (ø)
.../backend/src/app/modules/case/models/case.model.ts 74.73% <100.00%> (+0.13%) ⬆️
libs/judicial-system/types/src/index.ts 100.00% <100.00%> (ø)
libs/judicial-system/types/src/lib/case.ts 99.27% <100.00%> (+<0.01%) ⬆️
...m/api/src/app/modules/case/dto/updateCase.input.ts 0.00% <0.00%> (ø)
...stem/api/src/app/modules/case/models/case.model.ts 0.00% <0.00%> (ø)

... and 60 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 c1b6e41...7215834. 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6a583dc and d78dc83.

Files selected for processing (10)
  • apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts (2 hunks)
  • apps/judicial-system/api/src/app/modules/case/models/case.model.ts (3 hunks)
  • apps/judicial-system/backend/migrations/20240610131959-update-case.js (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts (2 hunks)
  • apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/models/case.model.ts (2 hunks)
  • apps/judicial-system/web/src/components/FormProvider/case.graphql (1 hunks)
  • apps/judicial-system/web/src/utils/hooks/useCase/updateCase.graphql (1 hunks)
  • libs/judicial-system/types/src/index.ts (1 hunks)
  • libs/judicial-system/types/src/lib/case.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • apps/judicial-system/api/src/app/modules/case/models/case.model.ts
  • libs/judicial-system/types/src/lib/case.ts
Additional context used
Path-based instructions (8)
apps/judicial-system/backend/migrations/20240610131959-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."
libs/judicial-system/types/src/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/judicial-system/web/src/utils/hooks/useCase/updateCase.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."
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."
apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.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/dto/updateCase.input.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/case/dto/updateCase.dto.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/case/models/case.model.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 (7)
libs/judicial-system/types/src/index.ts (1)

76-76: The addition of SubpoenaType to the exports is correctly implemented.

apps/judicial-system/web/src/utils/hooks/useCase/updateCase.graphql (1)

223-223: The addition of subpoenaType to the GraphQL mutation is correctly implemented.

apps/judicial-system/web/src/components/FormProvider/case.graphql (1)

267-267: The addition of subpoenaType to the GraphQL query is correctly implemented.

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

95-95: Addition of subpoenaType to districtCourtFields looks good.

#!/bin/bash
# Description: Verify that the front-end correctly handles the new `subpoenaType` field for district court roles.

# Test: Search for the usage of `districtCourtFields` in front-end components. Expect: Proper handling of `subpoenaType`.
rg --type tsx "districtCourtFields"
apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts (1)

500-503: Addition of subpoenaType field to UpdateCaseInput is implemented correctly.

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

507-510: Addition of subpoenaType field to UpdateCaseDto is implemented correctly.

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

1038-1047: The implementation of the subpoenaType property looks correct and follows the established patterns in the file. It's well-documented and uses the ENUM type appropriately.

@datadog-island-is
Copy link

datadog-island-is bot commented Jun 10, 2024

Datadog Report

All test runs 56f9e2b 🔗

8 Total Test Services: 0 Failed, 8 Passed
⬆️ Test Sessions change in coverage: 6 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 54 0 10.69s 1 increased (+0.09%) Link
judicial-system-backend 0 0 0 20375 0 18m 15.87s 1 increased (+0.02%) Link
judicial-system-formatters 0 0 0 36 0 10.12s 1 increased (+0.06%) Link
judicial-system-message 0 0 0 29 0 14.22s 1 no change Link
judicial-system-message-handler 0 0 0 3 0 7.99s 1 increased (+0.11%) Link
judicial-system-types 0 0 0 19 0 13.36s 1 increased (+0.18%) Link
judicial-system-web 0 0 0 312 0 1m 24.81s 1 no change Link
judicial-system-xrd-api 0 0 0 6 0 14.8s 1 increased (+0.09%) Link

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 d78dc83 and 7215834.

Files selected for processing (2)
  • apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts (1 hunks)
  • libs/judicial-system/types/src/lib/case.ts (1 hunks)
Additional context used
Path-based instructions (2)
apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.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/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."
Biome
libs/judicial-system/types/src/lib/case.ts

[error] 108-108: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 109-109: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 110-110: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 111-111: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 112-112: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 113-113: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 114-114: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 115-115: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 119-119: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 120-120: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 121-121: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 122-122: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 123-123: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 124-124: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 125-125: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 126-126: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 159-159: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 160-160: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 161-161: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 162-162: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)

Additional comments not posted (2)
apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts (1)

95-95: The addition of subpoenaType to districtCourtFields is appropriate for the intended functionality.

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

231-234: The addition of the SubpoenaType enum is correctly implemented and aligns with the PR's objectives.

@oddsson
Copy link
Member Author

oddsson commented Jun 11, 2024

Closed in favour of #15198

@oddsson oddsson closed this Jun 11, 2024
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.

1 participant