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): API endpoint to update subpoena #15051

Merged
merged 46 commits into from
Jun 4, 2024
Merged

feat(j-s): API endpoint to update subpoena #15051

merged 46 commits into from
Jun 4, 2024

Conversation

unakb
Copy link
Member

@unakb unakb commented Jun 3, 2024

API birtingar- endapunktar fyrir pósthólf til að setja verjanda

What

Added new API endpoint to set subpoena defense choice
Added new endpoint (WIP) that returns subpoena information for a defendant
Some refactoring of mapping logic in API layer

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 defenderChoice field to replace defendantWaivesRightToCounsel for better clarity on defense choices.
  • Bug Fixes

    • Improved validation and guard logic for defendant-related actions.
  • Refactor

    • Updated various methods and services to use defenderChoice instead of defendantWaivesRightToCounsel.
    • Enhanced data formatting and query handling for national IDs and defender choices.
  • Tests

    • Adjusted test cases to align with the new defenderChoice field and refined guard checks.

unakb and others added 30 commits May 27, 2024 14:26
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: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a86ff36 and dd1975e.

Files selected for processing (2)
  • apps/judicial-system/backend/src/app/modules/defendant/defendant.service.ts (2 hunks)
  • apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.tsx (4 hunks)
Additional context used
Path-based instructions (2)
apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.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/defendant/defendant.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."
Biome
apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.tsx

[error] 1-1: The default import is only used as a type.


[error] 12-16: Some named imports are only used as types.

apps/judicial-system/backend/src/app/modules/defendant/defendant.service.ts

[error] 38-38: Decorators are not valid here.


[error] 41-41: Decorators are not valid here.


[error] 1-2: All these imports are only used as types.


[error] 15-20: Some named imports are only used as types.


[error] 28-29: All these imports are only used as types.


[error] 29-30: All these imports are only used as types.


[error] 30-31: All these imports are only used as types.


[error] 32-33: All these imports are only used as types.

Additional comments not posted (3)
apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.tsx (3)

101-101: Ensure that the disabled property correctly handles the DefenderChoice.WAIVE state.

Verification successful

Ensure that the disabled property correctly handles the DefenderChoice.WAIVE state.

  • The search results show that the disabled property is used extensively across the codebase.
  • Specifically, in the file apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.tsx, the disabled property is set based on the defendant.defenderChoice === DefenderChoice.WAIVE condition.

Given the extensive usage of the disabled property and the specific context provided, it is crucial to verify that the DefenderChoice.WAIVE state is correctly handled in the SelectDefender.tsx file.

  • The disabled property correctly handles the DefenderChoice.WAIVE state in the SelectDefender.tsx file. The condition defendant.defenderChoice === DefenderChoice.WAIVE is appropriately used to set the disabled property.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Ensure that the `disabled` property correctly handles the `DefenderChoice.WAIVE` state.

# Test: Search for the usage of `disabled` property in relation to `DefenderChoice.WAIVE`. Expect: Consistent and correct usage.
rg --type typescript $'disabled'

Length of output: 66



Script:

#!/bin/bash
# Description: Ensure that the `disabled` property correctly handles the `DefenderChoice.WAIVE` state.

# Test: Search for the usage of `disabled` property in relation to `DefenderChoice.WAIVE`. Expect: Consistent and correct usage.
rg --type ts 'disabled'

Length of output: 129601


88-88: Verify that the checkbox correctly reflects the DefenderChoice.WAIVE state.

Verification successful

The search results indicate that DefenderChoice.WAIVE is used consistently in the codebase, including in the SelectDefender.tsx file where the checkbox state is being set. This suggests that the checkbox should correctly reflect the DefenderChoice.WAIVE state.

  • apps/judicial-system/web/src/utils/validate.ts
  • apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.tsx
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the checkbox correctly reflects the `DefenderChoice.WAIVE` state.

# Test: Search for the usage of `DefenderChoice.WAIVE` in the codebase. Expect: Consistent usage according to new requirements.
rg --type typescript $'DefenderChoice.WAIVE'

Length of output: 78



Script:

#!/bin/bash
# Description: Verify that the checkbox correctly reflects the `DefenderChoice.WAIVE` state.

# Test: Search for the usage of `DefenderChoice.WAIVE` in the codebase. Expect: Consistent usage according to new requirements.
rg --type ts $'DefenderChoice.WAIVE'

Length of output: 576


55-58: Ensure the logic for setting defenderChoice aligns with the new business requirements.

Verification successful

The logic for setting defenderChoice appears to be consistent with the new business requirements across the codebase. The relevant files show that defenderChoice is being set and used appropriately, particularly in SelectDefender.tsx, validate.ts, mocks.ts, and case.service.ts.

  • In SelectDefender.tsx, defenderChoice is set based on defendantWaivesRightToCounsel and used to control form behavior.
  • In validate.ts, defenderChoice is checked to validate the defender step.
  • In mocks.ts, defenderChoice is set to null for mock data.
  • In case.service.ts, defenderChoice is used in the context of updating and patching defender information.

These usages align with the expected logic and business requirements.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the logic for setting `defenderChoice` aligns with the new business requirements.

# Test: Search for the usage of `defenderChoice` in the codebase. Expect: Consistent usage according to new requirements.
rg --type typescript $'defenderChoice'

Length of output: 72



Script:

#!/bin/bash
# Description: Verify that the logic for setting `defenderChoice` aligns with the new business requirements.

# Test: Search for the usage of `defenderChoice` in the codebase. Expect: Consistent usage according to new requirements.
rg --type-add 'ts:*.{ts,tsx}' --type ts 'defenderChoice'

Length of output: 2908



Script:

#!/bin/bash
# Extract relevant lines from files where `defenderChoice` is used to verify consistency with new business requirements.

# Extract lines from SelectDefender.tsx
rg --type-add 'ts:*.{ts,tsx}' --type ts -A 5 -B 5 'defenderChoice' apps/judicial-system/web/src/routes/Court/Indictments/Defender/SelectDefender.tsx

# Extract lines from validate.ts
rg --type-add 'ts:*.{ts,tsx}' --type ts -A 5 -B 5 'defenderChoice' apps/judicial-system/web/src/utils/validate.ts

# Extract lines from mocks.ts
rg --type-add 'ts:*.{ts,tsx}' --type ts -A 5 -B 5 'defenderChoice' apps/judicial-system/web/src/utils/mocks.ts

# Extract lines from case.service.ts
rg --type-add 'ts:*.{ts,tsx}' --type ts -A 5 -B 5 'defenderChoice' apps/judicial-system/digital-mailbox-api/src/app/modules/cases/case.service.ts

Length of output: 4419

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 dd1975e and e8933f3.

Files selected for processing (1)
  • apps/judicial-system/digital-mailbox-api/src/app/modules/cases/case.controller.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/judicial-system/digital-mailbox-api/src/app/modules/cases/case.controller.ts

@unakb unakb added deprecated:automerge (Disabled) Merge this PR as soon as all checks pass and removed deprecated:automerge (Disabled) Merge this PR as soon as all checks pass labels Jun 4, 2024
@gudjong gudjong added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Jun 4, 2024
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 e8933f3 and 133f77d.

Files selected for processing (3)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1 hunks)
  • apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.graphql (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/prisonCases.graphql (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql
  • apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.graphql
  • apps/judicial-system/web/src/routes/Shared/Cases/prisonCases.graphql

@kodiakhq kodiakhq bot merged commit 1566034 into main Jun 4, 2024
30 checks passed
@kodiakhq kodiakhq bot deleted the j-s/update-subpoena branch June 4, 2024 18:19
@coderabbitai coderabbitai bot mentioned this pull request Nov 27, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants