-
Notifications
You must be signed in to change notification settings - Fork 61
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): Event to handle case sent to public prosecutor #15288
Conversation
WalkthroughThe changes introduce an Event Logging feature to the judicial system application. Key additions include the Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Files selected for processing (15)
- apps/judicial-system/api/src/app/app.module.ts (2 hunks)
- apps/judicial-system/api/src/app/data-sources/backend.ts (3 hunks)
- apps/judicial-system/api/src/app/modules/auth/auth.service.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/case/models/case.model.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/event-log/dto/createEventLog.input.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.config.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.module.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/event-log/index.ts (1 hunks)
- apps/judicial-system/api/src/app/modules/event-log/models/eventLog.model.ts (1 hunks)
- apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.ts (1 hunks)
- apps/judicial-system/web/src/routes/Court/Indictments/Completed/Completed.tsx (3 hunks)
- apps/judicial-system/web/src/utils/hooks/useEventLog/createEventLog.graphql (1 hunks)
- apps/judicial-system/web/src/utils/hooks/useEventLog/index.ts (1 hunks)
- libs/judicial-system/types/src/lib/eventLog.ts (1 hunks)
Files not reviewed due to errors (1)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts (no review received)
Files skipped from review due to trivial changes (4)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.config.ts
- apps/judicial-system/api/src/app/modules/event-log/eventLog.module.ts
- apps/judicial-system/api/src/app/modules/event-log/index.ts
- apps/judicial-system/api/src/app/modules/event-log/models/eventLog.model.ts
Additional context used
Path-based instructions (11)
apps/judicial-system/web/src/utils/hooks/useEventLog/createEventLog.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."
libs/judicial-system/types/src/lib/eventLog.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/api/src/app/modules/event-log/dto/createEventLog.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/event-log/eventLog.controller.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/hooks/useEventLog/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/api/src/app/modules/event-log/eventLog.resolver.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/app.module.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/auth/auth.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/api/src/app/data-sources/backend.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/Indictments/Completed/Completed.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/api/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."
Biome
apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.ts
[error] 16-16: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts
[error] 20-20: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 26-26: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 28-28: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 29-29: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.apps/judicial-system/api/src/app/modules/auth/auth.service.ts
[error] 30-30: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 32-32: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 121-125: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
Additional comments not posted (12)
apps/judicial-system/web/src/utils/hooks/useEventLog/createEventLog.graphql (1)
1-3
: The GraphQL mutation definition forCreateEventLog
looks concise and correctly formatted.libs/judicial-system/types/src/lib/eventLog.ts (1)
9-9
: AddingINDICTMENT_SENT_TO_PUBLIC_PROSECUTOR
to theEventType
enum aligns with the PR's objectives and ensures that new events can be handled appropriately.apps/judicial-system/api/src/app/modules/event-log/dto/createEventLog.input.ts (1)
1-22
: TheCreateEventLogInput
class is well-defined with appropriate use of decorators to ensure that the fields meet the validation and GraphQL schema requirements. The use of@IsOptional()
oncaseId
andnationalId
fields allows flexibility in logging events that might not always be tied to a specific case or user.
[APROVED]apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.ts (2)
1-14
: The controller setup withTokenGuard
ensures secure access to the event logging endpoint. The route and method decorators are correctly used to define the API's behavior.
16-16
: There seems to be a misunderstanding in the static analysis tool's error message about decorators. Since there are no decorators used incorrectly in this snippet, this issue can be ignored.Tools
Biome
[error] 16-16: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.apps/judicial-system/api/src/app/app.module.ts (1)
17-17
: The inclusion ofEventLogModule
in the application module is correctly implemented.Also applies to: 71-71
apps/judicial-system/api/src/app/modules/auth/auth.service.ts (1)
173-173
: The update to the fetch URL for event logging is correctly implemented and aligns with the new API endpoint structure.apps/judicial-system/api/src/app/data-sources/backend.ts (1)
11-13
: The import additions forEventType
,UserRole
, andCreateEventLogInput
are correctly implemented and necessary for the new functionality.Also applies to: 25-25
apps/judicial-system/web/src/routes/Court/Indictments/Completed/Completed.tsx (3)
29-29
: The import ofEventType
anduseEventLog
are correctly implemented for the new event logging functionality.Also applies to: 37-37
49-49
: TheuseEventLog
hook is correctly utilized to access thecreateEventLog
function, which is used appropriately to log events under specific conditions.Also applies to: 67-71
140-272
: The conditional rendering based on thesentToPublicProsecutor
state is correctly implemented to dynamically adjust UI components based on the case's event log status.apps/judicial-system/api/src/app/modules/case/models/case.model.ts (1)
29-29
: The addition of theEventLog
import is correctly implemented to support the new event logging functionality in theCase
model.
Datadog ReportAll test runs ✅ 8 Total Test Services: 0 Failed, 8 Passed Test Services
🔻 Code Coverage Decreases vs Default Branch (3) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15288 +/- ##
==========================================
+ Coverage 37.14% 37.16% +0.01%
==========================================
Files 6499 6481 -18
Lines 132176 131815 -361
Branches 37797 37678 -119
==========================================
- Hits 49100 48991 -109
+ Misses 83076 82824 -252
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 111 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this 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
Files selected for processing (1)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts
…b.com/island-is/island.is into j-s/send-and-save-service-requirement
There was a problem hiding this 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
Files selected for processing (5)
- apps/judicial-system/api/src/app/data-sources/backend.ts (3 hunks)
- apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts (1 hunks)
- apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.ts (1 hunks)
- apps/judicial-system/web/messages/Core/errors.ts (1 hunks)
- apps/judicial-system/web/src/utils/hooks/useEventLog/index.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- apps/judicial-system/api/src/app/data-sources/backend.ts
- apps/judicial-system/web/src/utils/hooks/useEventLog/index.ts
Additional context used
Path-based instructions (3)
apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.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/event-log/eventLog.resolver.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/Core/errors.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/backend/src/app/modules/event-log/eventLog.controller.ts
[error] 16-16: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts
[error] 20-20: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 26-26: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 28-28: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 29-29: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
Additional comments not posted (7)
apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.ts (3)
1-1
: LGTM! The updated controller path adheres to typical RESTful conventions.Also applies to: 9-9
11-11
: Constructor correctly implements dependency injection forEventLogService
.
14-14
: The use of@Post
and@ApiCreatedResponse
decorators is appropriate and correctly applied.apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.ts (3)
1-2
: Imports and decorators are correctly used to secure and define GraphQL resolver functionality.Also applies to: 16-16
19-22
: Constructor correctly implements dependency injection for logging. The error flagged by static analysis is a false positive.Tools
Biome
[error] 20-20: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
24-35
: The GraphQL mutation is correctly implemented with appropriate use of decorators for parameters and context. The errors flagged by static analysis are false positives.Tools
Biome
[error] 26-26: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 28-28: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 29-29: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.apps/judicial-system/web/messages/Core/errors.ts (1)
120-124
: The addition of the new error message for event log creation failure is clear and consistent with existing error handling patterns.
There was a problem hiding this 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
Files selected for processing (1)
- apps/judicial-system/api/src/app/data-sources/backend.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/judicial-system/api/src/app/data-sources/backend.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions.
apps/judicial-system/web/src/routes/Court/Indictments/Completed/Completed.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
Files selected for processing (4)
- apps/judicial-system/api/src/app/app.module.ts (2 hunks)
- apps/judicial-system/api/src/app/modules/index.ts (1 hunks)
- apps/judicial-system/web/src/routes/Court/Indictments/Completed/Completed.tsx (2 hunks)
- apps/judicial-system/web/src/utils/hooks/useEventLog/index.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- apps/judicial-system/api/src/app/modules/index.ts
Files skipped from review as they are similar to previous changes (3)
- apps/judicial-system/api/src/app/app.module.ts
- apps/judicial-system/web/src/routes/Court/Indictments/Completed/Completed.tsx
- apps/judicial-system/web/src/utils/hooks/useEventLog/index.ts
Héraðsdómur á ekki að þurfa að taka afstöðu til birtingar dóms oftar en einu sinni
What
Created an event that signals that an indictment case has been sent to the public prosecutors office
Why
So that district court judges can see which cases they've sent and so we can hide the button and service requirement choices once they've been decided.
Checklist:
Summary by CodeRabbit
New Features
INDICTMENT_SENT_TO_PUBLIC_PROSECUTOR
.Enhancements
Bug Fixes
Documentation
Refactor