-
Notifications
You must be signed in to change notification settings - Fork 62
fix(j-s): rename subpoenaId to policeSubpoenaId #18836
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis change set systematically renames the identifier field for police subpoenas from Changes
Sequence Diagram(s)sequenceDiagram
participant Frontend
participant GraphQL API
participant Backend Service
participant Database
Frontend->>GraphQL API: Query/Mutation with policeSubpoenaId
GraphQL API->>Backend Service: Call with policeSubpoenaId
Backend Service->>Database: Query/Update using policeSubpoenaId
Database-->>Backend Service: Result
Backend Service-->>GraphQL API: Response with policeSubpoenaId
GraphQL API-->>Frontend: Response with policeSubpoenaId
Suggested labels
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
View your CI Pipeline Execution ↗ for commit d68f8f3.
☁️ Nx Cloud last updated this comment at |
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
🧹 Nitpick comments (1)
apps/judicial-system/backend/migrations/20250422152214-update-supoena-id.js (1)
1-3
: Remove redundant 'use strict' directiveJavaScript modules are automatically in strict mode, making this directive unnecessary.
-'use strict' module.exports = {
🧰 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)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
apps/judicial-system/api/src/app/modules/subpoena/models/subpoena.model.ts
(1 hunks)apps/judicial-system/backend/migrations/20250422152214-update-supoena-id.js
(1 hunks)apps/judicial-system/backend/src/app/modules/police/models/createSubpoena.response.ts
(1 hunks)apps/judicial-system/backend/src/app/modules/police/police.service.ts
(1 hunks)apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts
(1 hunks)apps/judicial-system/backend/src/app/modules/subpoena/internalSubpoena.controller.ts
(1 hunks)apps/judicial-system/backend/src/app/modules/subpoena/models/subpoena.model.ts
(1 hunks)apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts
(7 hunks)apps/judicial-system/web/src/components/FormProvider/case.graphql
(2 hunks)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/cases.graphql
(1 hunks)apps/judicial-system/web/src/utils/hooks/useSubpoena/index.ts
(1 hunks)apps/judicial-system/web/src/utils/hooks/useSubpoena/subpoena.graphql
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`apps/**/*`: "Confirm that the code adheres to the following: - NextJS best practices, including file structure, API routes, and static generation methods. - Efficient state manage...
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/useSubpoena/subpoena.graphql
apps/judicial-system/backend/src/app/modules/police/models/createSubpoena.response.ts
apps/judicial-system/backend/src/app/modules/subpoena/internalSubpoena.controller.ts
apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.graphql
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql
apps/judicial-system/backend/src/app/modules/police/police.service.ts
apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts
apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql
apps/judicial-system/backend/src/app/modules/subpoena/models/subpoena.model.ts
apps/judicial-system/backend/migrations/20250422152214-update-supoena-id.js
apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts
apps/judicial-system/web/src/components/FormProvider/case.graphql
apps/judicial-system/web/src/utils/hooks/useSubpoena/index.ts
apps/judicial-system/api/src/app/modules/subpoena/models/subpoena.model.ts
🧠 Learnings (13)
apps/judicial-system/web/src/utils/hooks/useSubpoena/subpoena.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.
apps/judicial-system/backend/src/app/modules/police/models/createSubpoena.response.ts (2)
Learnt from: oddsson
PR: island-is/island.is#16177
File: apps/judicial-system/backend/src/app/modules/subpoena/dto/updateSubpoena.dto.ts:16-16
Timestamp: 2024-10-04T15:11:19.318Z
Learning: In the TypeScript file `apps/judicial-system/xrd-api/src/app/dto/subpoena.dto.ts`, the property is `servedBy`, not `registeredBy`. It is correctly named, and no renaming is necessary.
Learnt from: unakb
PR: island-is/island.is#16393
File: apps/judicial-system/digital-mailbox-api/src/app/modules/cases/models/subpoena.response.ts:164-169
Timestamp: 2024-10-14T21:34:16.234Z
Learning: Ensure that suggested code changes in `subpoena.response.ts` are accurate and necessary, avoiding redundant suggestions.
apps/judicial-system/backend/src/app/modules/subpoena/internalSubpoena.controller.ts (3)
Learnt from: gudjong
PR: island-is/island.is#16863
File: apps/judicial-system/backend/src/app/modules/subpoena/subpoena.controller.ts:86-98
Timestamp: 2024-11-27T15:27:52.059Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.controller.ts`, user action auditing and exception handling are performed at a higher level, so explicit error handling and logging within the `getSubpoena` method is unnecessary.
Learnt from: unakb
PR: island-is/island.is#16393
File: apps/judicial-system/digital-mailbox-api/src/app/modules/cases/models/subpoena.response.ts:164-169
Timestamp: 2024-10-14T21:34:16.234Z
Learning: Ensure that suggested code changes in `subpoena.response.ts` are accurate and necessary, avoiding redundant suggestions.
Learnt from: oddsson
PR: island-is/island.is#16329
File: apps/judicial-system/backend/src/app/modules/notification/subpoenaNotification.service.ts:0-0
Timestamp: 2024-10-15T10:31:27.440Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts`, the method `findBySubpoenaId` throws an error if the subpoena is not found. Therefore, downstream code does not need to check if the result is undefined.
apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.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.
apps/judicial-system/web/src/routes/Shared/Cases/cases.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.
apps/judicial-system/backend/src/app/modules/police/police.service.ts (1)
Learnt from: unakb
PR: island-is/island.is#16393
File: apps/judicial-system/digital-mailbox-api/src/app/modules/cases/models/subpoena.response.ts:164-169
Timestamp: 2024-10-14T21:34:16.234Z
Learning: Ensure that suggested code changes in `subpoena.response.ts` are accurate and necessary, avoiding redundant suggestions.
apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts (3)
Learnt from: gudjong
PR: island-is/island.is#16863
File: apps/judicial-system/backend/src/app/modules/subpoena/limitedAccessSubpoena.controller.ts:56-56
Timestamp: 2024-11-27T15:15:53.740Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.controller.ts`, the usage of `SubpoenaExistsOptionalGuard` is correct and should not be replaced.
Learnt from: oddsson
PR: island-is/island.is#16463
File: apps/judicial-system/backend/src/app/modules/subpoena/test/limitedAccessSubpoenaController/limitedAccessSubpoenaControllerGuards.spec.ts:17-17
Timestamp: 2024-10-21T21:14:47.668Z
Learning: In `LimitedAccessSubpoenaController`, `SubpoenaExistsOptionalGuard` is still used on specific endpoints not covered by the test file `limitedAccessSubpoenaControllerGuards.spec.ts`.
Learnt from: oddsson
PR: island-is/island.is#16329
File: apps/judicial-system/backend/src/app/modules/notification/subpoenaNotification.service.ts:0-0
Timestamp: 2024-10-15T10:31:27.440Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts`, the method `findBySubpoenaId` throws an error if the subpoena is not found. Therefore, downstream code does not need to check if the result is undefined.
apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.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.
apps/judicial-system/backend/src/app/modules/subpoena/models/subpoena.model.ts (1)
Learnt from: oddsson
PR: island-is/island.is#16177
File: apps/judicial-system/backend/src/app/modules/subpoena/dto/updateSubpoena.dto.ts:16-16
Timestamp: 2024-10-04T15:11:19.318Z
Learning: In the TypeScript file `apps/judicial-system/xrd-api/src/app/dto/subpoena.dto.ts`, the property is `servedBy`, not `registeredBy`. It is correctly named, and no renaming is necessary.
apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts (2)
Learnt from: oddsson
PR: island-is/island.is#16329
File: apps/judicial-system/backend/src/app/modules/notification/subpoenaNotification.service.ts:0-0
Timestamp: 2024-10-15T10:31:27.440Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts`, the method `findBySubpoenaId` throws an error if the subpoena is not found. Therefore, downstream code does not need to check if the result is undefined.
Learnt from: oddsson
PR: island-is/island.is#16177
File: apps/judicial-system/backend/src/app/modules/subpoena/dto/updateSubpoena.dto.ts:16-16
Timestamp: 2024-10-04T15:11:19.318Z
Learning: In the TypeScript file `apps/judicial-system/xrd-api/src/app/dto/subpoena.dto.ts`, the property is `servedBy`, not `registeredBy`. It is correctly named, and no renaming is necessary.
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.
apps/judicial-system/web/src/utils/hooks/useSubpoena/index.ts (2)
Learnt from: unakb
PR: island-is/island.is#16393
File: apps/judicial-system/digital-mailbox-api/src/app/modules/cases/models/subpoena.response.ts:164-169
Timestamp: 2024-10-14T21:34:16.234Z
Learning: Ensure that suggested code changes in `subpoena.response.ts` are accurate and necessary, avoiding redundant suggestions.
Learnt from: oddsson
PR: island-is/island.is#16329
File: apps/judicial-system/backend/src/app/modules/notification/subpoenaNotification.service.ts:0-0
Timestamp: 2024-10-15T10:31:27.440Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts`, the method `findBySubpoenaId` throws an error if the subpoena is not found. Therefore, downstream code does not need to check if the result is undefined.
apps/judicial-system/api/src/app/modules/subpoena/models/subpoena.model.ts (1)
Learnt from: oddsson
PR: island-is/island.is#16177
File: apps/judicial-system/backend/src/app/modules/subpoena/dto/updateSubpoena.dto.ts:16-16
Timestamp: 2024-10-04T15:11:19.318Z
Learning: In the TypeScript file `apps/judicial-system/xrd-api/src/app/dto/subpoena.dto.ts`, the property is `servedBy`, not `registeredBy`. It is correctly named, and no renaming is necessary.
🪛 Biome (1.9.4)
apps/judicial-system/backend/migrations/20250422152214-update-supoena-id.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 (23)
apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.graphql (1)
29-29
: Correctly renamed field from subpoenaId to policeSubpoenaIdThe field rename is consistent with the PR objective to make a clear distinction between
subpoenaId
andsubpoena.id
. This change helps prevent confusion and potential bugs by using more specific naming.apps/judicial-system/backend/src/app/modules/police/models/createSubpoena.response.ts (1)
5-5
: API response property successfully renamedThe property in the
CreateSubpoenaResponse
class has been correctly renamed fromsubpoenaId
topoliceSubpoenaId
. This change affects the API response shape, which is consistent with the PR objective to standardize terminology across the application.apps/judicial-system/web/src/utils/hooks/useSubpoena/subpoena.graphql (1)
12-12
: GraphQL query field appropriately renamedThe field has been successfully renamed from
subpoenaId
topoliceSubpoenaId
in the Subpoena GraphQL query. This change aligns with NextJS and TypeScript best practices by ensuring consistency in field naming across the frontend and backend.apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts (1)
24-26
: Service method call updated to match renamed methodThe guard has been updated to call
findByPoliceSubpoenaId()
instead offindBySubpoenaId()
, which correctly aligns with the service method renaming. This ensures consistent terminology throughout the codebase and maintains the guard's functionality.apps/judicial-system/backend/src/app/modules/subpoena/models/subpoena.model.ts (1)
57-57
: Field renamed correctly to improve clarity.The property has been renamed from
subpoenaId
topoliceSubpoenaId
which aligns with the PR objectives of distinguishing this field fromsubpoena.id
. This rename will help prevent confusion and potential bugs from mixing these identifiers.apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1)
37-37
: Field renamed correctly in GraphQL query.The
policeSubpoenaId
field name is now being used consistently in the GraphQL query, matching the backend model changes. This ensures data fetching remains intact across the application.apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1)
65-65
: Field renamed correctly in limitedAccessCase GraphQL query.The
policeSubpoenaId
field name is now being used consistently in this query, matching the backend model changes and other GraphQL queries. This consistency across the codebase ensures proper data handling.apps/judicial-system/api/src/app/modules/subpoena/models/subpoena.model.ts (1)
19-19
: Field renamed correctly in GraphQL model.The property has been renamed from
subpoenaId
topoliceSubpoenaId
in the GraphQL model while preserving its nullable String type definition. This change properly aligns the API layer with the backend model changes and ensures consistent naming across the stack.apps/judicial-system/backend/src/app/modules/subpoena/internalSubpoena.controller.ts (1)
99-99
: Properly renamed property to policeSubpoenaIdThis change correctly renames the property accessed on the
currentSubpoena
object fromsubpoenaId
topoliceSubpoenaId
in the audit logging callback function. This aligns with the PR objective to avoid confusion betweensubpoenaId
andsubpoena.id
.apps/judicial-system/web/src/utils/hooks/useSubpoena/index.ts (1)
10-11
: Updated skip condition to check for policeSubpoenaIdThe condition for skipping the GraphQL query has been properly updated to check for the existence of
policeSubpoenaId
instead ofsubpoenaId
. This change correctly implements the renaming pattern consistent with the rest of the codebase.This change maintains TypeScript type safety while ensuring the hook's behavior remains the same, adhering to NextJS best practices for efficient component state management.
apps/judicial-system/web/src/components/FormProvider/case.graphql (2)
53-53
: Renamed GraphQL field to policeSubpoenaId in defendants.subpoenasThe GraphQL query has been updated to request
policeSubpoenaId
instead ofsubpoenaId
, ensuring the frontend aligns with the backend model changes.
372-372
: Renamed GraphQL field to policeSubpoenaId in mergedCases.defendants.subpoenasThe field has been appropriately renamed in the nested structure for merged cases, maintaining consistency throughout the query.
apps/judicial-system/backend/src/app/modules/police/police.service.ts (1)
666-666
: Updated response property name to policeSubpoenaIdThe property name in the return object of the
createSubpoena
method has been properly updated fromsubpoenaId
topoliceSubpoenaId
. This ensures consistency with the renamed field in theCreateSubpoenaResponse
model and the broader renaming effort across the codebase.apps/judicial-system/backend/migrations/20250422152214-update-supoena-id.js (2)
4-17
: Migration correctly renames the column in a transactionThe migration properly uses a transaction to rename the database column from
subpoena_id
topolice_subpoena_id
, ensuring atomicity of the change.
19-32
: Down migration correctly handles reverting the column nameThe down migration properly reverses the change by renaming the column back to
subpoena_id
if needed, also wrapped in a transaction for safety.apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts (8)
289-302
: Method renamed for clarity and consistencyThe method has been correctly renamed from
findBySubpoenaId
tofindByPoliceSubpoenaId
to align with the PR objective of renaming the field to prevent confusion betweensubpoenaId
andsubpoena.id
. The error message has also been updated appropriately.Based on the retrieved learnings, this method throws an error if the subpoena is not found, which is maintained in this update.
356-357
: Field reference updated consistentlyThe field reference in the update operation has been correctly changed from
subpoenaId
topoliceSubpoenaId
.
367-368
: Log message updated to reflect new field nameThe log message has been updated to reference
policeSubpoenaId
instead ofsubpoenaId
, maintaining consistency in terminology throughout the codebase.
489-494
: Condition check updated for new field nameThe check for the existence of the subpoena ID has been updated to use
policeSubpoenaId
instead ofsubpoenaId
.
497-500
: Method parameter updated for consistencyThe call to the police service's
revokeSubpoena
method now correctly usespoliceSubpoenaId
.
504-505
: Log message updated for new field nameThe log message formatting has been updated to reference
policeSubpoenaId
instead ofsubpoenaId
, maintaining consistent terminology.
513-516
: Condition check updated for renamed fieldThe check for the existence of the subpoena ID has been updated to use
policeSubpoenaId
instead ofsubpoenaId
.
526-528
: Service call updated to use renamed fieldThe call to
getSubpoenaStatus
now correctly passes thepoliceSubpoenaId
instead ofsubpoenaId
.
Datadog ReportAll test runs ✅ 4 Total Test Services: 0 Failed, 4 Passed Test Services
|
apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts
Outdated
Show resolved
Hide resolved
apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts
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
🧹 Nitpick comments (1)
apps/judicial-system/xrd-api/src/app/app.service.ts (1)
168-171
: Consider removing or clarifying the TODO comment.The TODO comment seems to be describing the current state rather than indicating future work. Consider removing it or clarifying what action is needed.
- // TODO: this is now police subpoena id + // Using policeSubpoenaId in API callThe URL path in the fetch call has been correctly updated to use
policeSubpoenaId
.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
apps/judicial-system/backend/src/app/modules/police/police.service.ts
(8 hunks)apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts
(1 hunks)apps/judicial-system/backend/src/app/modules/subpoena/guards/test/policeSubpoenaExistsGuard.spec.ts
(3 hunks)apps/judicial-system/backend/src/app/modules/subpoena/internalSubpoena.controller.ts
(2 hunks)apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts
(7 hunks)apps/judicial-system/backend/src/app/modules/subpoena/test/internalSubpoenaController/deliverSubpoenaRevocationToPolice.spec.ts
(1 hunks)apps/judicial-system/xrd-api/src/app/app.controller.ts
(1 hunks)apps/judicial-system/xrd-api/src/app/app.service.ts
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/judicial-system/backend/src/app/modules/subpoena/guards/policeSubpoenaExists.guard.ts
- apps/judicial-system/backend/src/app/modules/subpoena/internalSubpoena.controller.ts
- apps/judicial-system/backend/src/app/modules/subpoena/subpoena.service.ts
- apps/judicial-system/backend/src/app/modules/police/police.service.ts
🧰 Additional context used
📓 Path-based instructions (1)
`apps/**/*`: "Confirm that the code adheres to the following: - NextJS best practices, including file structure, API routes, and static generation methods. - Efficient state manage...
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/subpoena/test/internalSubpoenaController/deliverSubpoenaRevocationToPolice.spec.ts
apps/judicial-system/xrd-api/src/app/app.service.ts
apps/judicial-system/backend/src/app/modules/subpoena/guards/test/policeSubpoenaExistsGuard.spec.ts
apps/judicial-system/xrd-api/src/app/app.controller.ts
🧠 Learnings (4)
apps/judicial-system/backend/src/app/modules/subpoena/test/internalSubpoenaController/deliverSubpoenaRevocationToPolice.spec.ts (2)
Learnt from: unakb
PR: island-is/island.is#16393
File: apps/judicial-system/digital-mailbox-api/src/app/modules/cases/models/subpoena.response.ts:164-169
Timestamp: 2024-10-14T21:34:16.234Z
Learning: Ensure that suggested code changes in `subpoena.response.ts` are accurate and necessary, avoiding redundant suggestions.
Learnt from: unakb
PR: island-is/island.is#16863
File: apps/judicial-system/api/src/app/modules/subpoena/subpoena.resolver.ts:38-40
Timestamp: 2024-11-27T10:45:48.795Z
Learning: In the `SubpoenaResolver` class in `apps/judicial-system/api/src/app/modules/subpoena/subpoena.resolver.ts`, logging UUIDs such as `subpoenaId`, `defendantId`, and `caseId` is acceptable, as they are not considered sensitive in this context.
apps/judicial-system/xrd-api/src/app/app.service.ts (1)
Learnt from: oddsson
PR: island-is/island.is#16177
File: apps/judicial-system/backend/src/app/modules/subpoena/dto/updateSubpoena.dto.ts:16-16
Timestamp: 2024-10-04T15:11:19.318Z
Learning: In the TypeScript file `apps/judicial-system/xrd-api/src/app/dto/subpoena.dto.ts`, the property is `servedBy`, not `registeredBy`. It is correctly named, and no renaming is necessary.
apps/judicial-system/backend/src/app/modules/subpoena/guards/test/policeSubpoenaExistsGuard.spec.ts (2)
Learnt from: oddsson
PR: island-is/island.is#16463
File: apps/judicial-system/backend/src/app/modules/subpoena/test/limitedAccessSubpoenaController/limitedAccessSubpoenaControllerGuards.spec.ts:17-17
Timestamp: 2024-10-21T21:14:47.668Z
Learning: In `LimitedAccessSubpoenaController`, `SubpoenaExistsOptionalGuard` is still used on specific endpoints not covered by the test file `limitedAccessSubpoenaControllerGuards.spec.ts`.
Learnt from: gudjong
PR: island-is/island.is#16863
File: apps/judicial-system/backend/src/app/modules/subpoena/limitedAccessSubpoena.controller.ts:56-56
Timestamp: 2024-11-27T15:15:53.740Z
Learning: In `apps/judicial-system/backend/src/app/modules/subpoena/subpoena.controller.ts`, the usage of `SubpoenaExistsOptionalGuard` is correct and should not be replaced.
apps/judicial-system/xrd-api/src/app/app.controller.ts (1)
Learnt from: oddsson
PR: island-is/island.is#16177
File: apps/judicial-system/backend/src/app/modules/subpoena/dto/updateSubpoena.dto.ts:16-16
Timestamp: 2024-10-04T15:11:19.318Z
Learning: In the TypeScript file `apps/judicial-system/xrd-api/src/app/dto/subpoena.dto.ts`, the property is `servedBy`, not `registeredBy`. It is correctly named, and no renaming is necessary.
🔇 Additional comments (12)
apps/judicial-system/backend/src/app/modules/subpoena/test/internalSubpoenaController/deliverSubpoenaRevocationToPolice.spec.ts (1)
23-23
: LGTM! Field renamed to match PR objective.The change correctly implements the renaming from
subpoenaId
topoliceSubpoenaId
in the subpoena object. This ensures consistency with the changes in the rest of the codebase and helps avoid confusion betweensubpoena.id
and the police-specific identifier.apps/judicial-system/backend/src/app/modules/subpoena/guards/test/policeSubpoenaExistsGuard.spec.ts (4)
51-51
: LGTM! Field renamed to match PR objective.The change correctly updates the test data to use
policeSubpoenaId
instead ofsubpoenaId
in the subpoena mock object.
53-53
: LGTM! Parameter renamed consistently.The request params now use
policeSubpoenaId
which correctly aligns with the renamed field in the guard implementation.
69-69
: LGTM! Query condition updated correctly.The where clause in the database query has been properly updated to use
policeSubpoenaId
.
82-82
: LGTM! Parameter renamed consistently.The request params are correctly updated to use
policeSubpoenaId
in this test case as well.apps/judicial-system/xrd-api/src/app/app.controller.ts (4)
74-75
: LGTM! Route and comment updated correctly.The endpoint route and associated comment have been properly updated to use
policeSubpoenaId
instead ofsubpoenaId
.
79-79
: LGTM! Method parameter renamed consistently.The parameter has been correctly updated from
subpoenaId
topoliceSubpoenaId
in the controller method signature.
82-82
: LGTM! Log message updated correctly.The logging statement has been updated to refer to the subpoena using the renamed
policeSubpoenaId
.
84-84
: LGTM! Service method call updated correctly.The service method call has been updated to use the renamed
policeSubpoenaId
parameter.apps/judicial-system/xrd-api/src/app/app.service.ts (3)
84-85
: LGTM! Method parameter renamed consistently.The parameter in the
updateSubpoena
method has been correctly updated fromsubpoenaId
topoliceSubpoenaId
.
90-92
: LGTM! Method call and audit information updated correctly.Both the method call and the audit information now use
policeSubpoenaId
consistently.
96-97
: LGTM! Private method parameter renamed consistently.The parameter in the private
updateSubpoenaInfo
method has been correctly updated fromsubpoenaId
topoliceSubpoenaId
.
Rename subpoenaId to policeSubpoenaId
What
subpoenaId
topoliceSubpoenaId
to avoid confusingsubpoena.subpoenaId
andsubpoena.id
Why
subpoenaId
all over the place for thesubpoenaId
and we have made one bug on mixing id with police subpoena id, so we rename it to make it more clearChecklist:
Summary by CodeRabbit