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(ids-api): index delegations when IDS gets delegations #15079

Merged
merged 6 commits into from
Jun 5, 2024

Conversation

Herdismaria
Copy link
Contributor

@Herdismaria Herdismaria commented Jun 4, 2024

☝️

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

    • Enhanced delegation management with the introduction of DelegationsIndexService for more efficient delegation indexing.
  • Refactor

    • Updated delegation methods to use AuthDelegationType for improved consistency and clarity.

@Herdismaria Herdismaria requested review from a team as code owners June 4, 2024 11:11
Copy link
Contributor

coderabbitai bot commented Jun 4, 2024

Walkthrough

The changes involve integrating a new service, DelegationsIndexService, into the DelegationsController and updating the delegation type used from DelegationType to AuthDelegationType. This update ensures consistent delegation handling and enhances delegation indexing functionality. Additionally, corresponding test files have been updated to mock and test the new service.

Changes

Files Change Summary
apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts Added AuthDelegationType import, introduced DelegationsIndexService, and updated method logic to use AuthDelegationType.
apps/services/auth/ids-api/src/app/delegations/test/delegations-filters.spec.ts Modified DelegationDTO import to include DelegationsIndexService and initialized it in test setup.
apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts Added DelegationsIndexService import, declared and initialized delegationIndexService, and mocked indexDelegations method.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant DelegationsController
    participant DelegationsIndexService
    
    User->>DelegationsController: findAllToV1()
    DelegationsController->>DelegationsIndexService: indexDelegations(user)
    DelegationsIndexService-->>DelegationsController: DelegationsData
    DelegationsController-->>User: Return DelegationsData
    
    User->>DelegationsController: findAllAvailable(delegationType)
    DelegationsController->>DelegationsIndexService: indexDelegations(user)
    DelegationsIndexService-->>DelegationsController: DelegationsData
    DelegationsController-->>User: Return DelegationsData
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
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 6fa6386 and 11df161.

Files selected for processing (1)
  • apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (6 hunks)
Additional context used
Path-based instructions (1)
apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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/services/auth/ids-api/src/app/delegations/delegations.controller.ts

[error] 48-48: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 59-59: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 60-63: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 78-78: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 79-79: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 80-83: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.

Additional comments not posted (5)
apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (5)

19-19: Integration of DelegationsIndexService is consistent with NestJS dependency injection patterns.


42-42: Proper use of dependency injection for DelegationsIndexService.


84-84: Update to AuthDelegationType is consistent with the changes in the import statements.


88-88: Use of conditional logic based on delegationType to determine which scopes to fetch is clear and maintainable.

Also applies to: 91-91, 96-96, 104-104


119-120: Ensure that the conditions are necessary for the logic to function correctly.

Verification successful

The conditions checking for AuthDelegationType.ProcurationHolder and AuthDelegationType.LegalGuardian are necessary for the logic in the findAllScopesTo method. These conditions determine which specific scopes to retrieve and ensure that automatic scopes are included when certain delegation types are present.

  • apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts: The conditions are part of the logic to retrieve and combine different types of scopes based on the delegation type.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the necessity of conditions in the scope determination logic.

# Test: Check if the conditions are redundant by reviewing the method logic and testing.
echo "Review the necessity of conditions in the findAllScopesTo method."

Length of output: 140



Script:

#!/bin/bash
# Locate the findAllScopesTo method definition in the codebase
ast-grep --lang typescript --pattern 'findAllScopesTo($_) { $$$ }'

# Search for references to AuthDelegationType in the codebase
rg 'AuthDelegationType'

Length of output: 53297



Script:

#!/bin/bash
# Corrected pattern to locate the findAllScopesTo method definition in the codebase
ast-grep --lang typescript --pattern 'function findAllScopesTo($_) { $$$ }'

Length of output: 77



Script:

#!/bin/bash
# Search for the findAllScopesTo method name in the codebase
rg 'findAllScopesTo'

Length of output: 118



Script:

#!/bin/bash
# Extract the findAllScopesTo method implementation from the delegations.controller.ts file
ast-grep --lang typescript --pattern 'async findAllScopesTo($_) { $$$ }' apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts

Length of output: 603



Script:

#!/bin/bash
# Corrected pattern to extract the findAllScopesTo method implementation from the delegations.controller.ts file
ast-grep --lang typescript --pattern 'class $_ { $$$ async findAllScopesTo($_) { $$$ } $$$ }' apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts

Length of output: 168



Script:

#!/bin/bash
# Search for the findAllScopesTo method name and extract the surrounding lines to get the method implementation
rg -A 20 'async findAllScopesTo' apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts

Length of output: 860



Script:

#!/bin/bash
# Extract more lines from the findAllScopesTo method to get the complete implementation
rg -A 40 'async findAllScopesTo' apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts

Length of output: 1452



Script:

#!/bin/bash
# Extract even more lines from the findAllScopesTo method to ensure we have the complete implementation
rg -A 60 'async findAllScopesTo' apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts

Length of output: 1784

@datadog-island-is
Copy link

datadog-island-is bot commented Jun 4, 2024

Datadog Report

All test runs 78dea6d 🔗

27 Total Test Services: 0 Failed, 26 Passed
⬆️ Test Sessions change in coverage: 2 increased, 62 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 4.24s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 19.77s 1 no change Link
api-domains-communications 0 0 0 5 0 43.66s 1 no change Link
api-domains-license-service 0 0 0 0 0 1.14s 1 no change Link
application-system-api 0 0 0 111 2 3m 38.72s 1 no change Link
application-template-api-modules 0 0 0 109 0 3m 14.66s 1 no change Link
application-ui-shell 0 0 0 74 0 1m 11.76s 1 no change Link
auth-api-lib 0 0 0 13 0 55.27s 1 increased (+0.02%) Link
cms-translations 0 0 0 3 0 47.34s 1 no change Link
judicial-system-api 0 0 0 54 0 9.45s 1 no change Link

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Project coverage is 37.11%. Comparing base (eebb157) to head (835d044).
Report is 1 commits behind head on main.

Current head 835d044 differs from pull request most recent head 6b073f9

Please upload reports for the commit 6b073f9 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15079   +/-   ##
=======================================
  Coverage   37.10%   37.11%           
=======================================
  Files        6415     6415           
  Lines      130593   130596    +3     
  Branches    37293    37288    -5     
=======================================
+ Hits        48455    48468   +13     
+ Misses      82138    82128   -10     
Flag Coverage Δ
api 3.44% <ø> (ø)
api-domains-auth-admin 57.91% <ø> (ø)
api-domains-communications 40.61% <ø> (ø)
application-system-api 42.00% <ø> (ø)
application-template-api-modules 24.23% <ø> (-0.01%) ⬇️
application-templates-estate 11.90% <ø> (ø)
application-templates-inheritance-report 4.27% <ø> (ø)
application-ui-shell 21.78% <ø> (ø)
auth-api-lib 9.60% <ø> (+0.04%) ⬆️
cms 0.44% <ø> (ø)
cms-translations 39.70% <ø> (ø)
judicial-system-api 17.83% <ø> (ø)
judicial-system-audit-trail 67.31% <ø> (ø)
judicial-system-backend 55.88% <ø> (ø)
judicial-system-formatters 81.02% <ø> (ø)
judicial-system-message 65.65% <ø> (ø)
judicial-system-message-handler 65.76% <ø> (ø)
judicial-system-types 48.65% <ø> (ø)
services-auth-admin-api 51.96% <ø> (ø)
services-auth-delegation-api 61.77% <ø> (ø)
services-auth-ids-api 55.06% <90.90%> (+0.46%) ⬆️
services-auth-personal-representative 48.53% <ø> (ø)
services-auth-personal-representative-public 44.34% <ø> (ø)
services-auth-public-api 49.85% <ø> (+0.01%) ⬆️
services-user-notification 47.58% <ø> (ø)
services-user-profile 62.59% <ø> (ø)
web 1.94% <ø> (ø)

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

Files Coverage Δ
.../ids-api/src/app/delegations/delegations.module.ts 100.00% <100.00%> (ø)
...-api/src/app/delegations/delegations.controller.ts 95.74% <90.47%> (-4.26%) ⬇️

... and 5 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 ebcf5c8...6b073f9. Read the comment docs.

@Herdismaria Herdismaria force-pushed the feat/index-delegations-when-selecting-account branch from 59ba3c3 to af9f3d0 Compare June 4, 2024 13:15
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

Outside diff range and nitpick comments (1)
apps/services/auth/ids-api/src/app/delegations/delegations.controller.spec.ts (1)

Line range hint 239-388: Duplicate setup/teardown hooks and inefficient forEach usage.

Please refactor to avoid duplicate beforeAll and afterAll hooks and replace forEach with more efficient loops like for...of to enhance performance and readability.

Also applies to: 390-410, 492-497, 589-607, 609-628, 741-886, 888-908, 994-999, 1095-1116, 1118-1137

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 11df161 and af9f3d0.

Files selected for processing (2)
  • apps/services/auth/ids-api/src/app/delegations/delegations.controller.spec.ts (14 hunks)
  • apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (6 hunks)
Additional context used
Path-based instructions (2)
apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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/services/auth/ids-api/src/app/delegations/delegations.controller.spec.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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/services/auth/ids-api/src/app/delegations/delegations.controller.ts

[error] 47-47: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 59-59: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 60-63: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 80-80: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 81-81: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 82-85: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.

apps/services/auth/ids-api/src/app/delegations/delegations.controller.spec.ts

[error] 239-388: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow beforeAll duplicacy inside the describe function.


[error] 390-410: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow afterAll duplicacy inside the describe function.


[error] 492-497: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 589-607: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow beforeAll duplicacy inside the describe function.


[error] 609-628: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow afterAll duplicacy inside the describe function.


[error] 741-886: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow beforeAll duplicacy inside the describe function.


[error] 888-908: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow afterAll duplicacy inside the describe function.


[error] 994-999: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 1095-1116: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow beforeAll duplicacy inside the describe function.


[error] 1118-1137: Disallow duplicate setup and teardown hooks. (lint/suspicious/noDuplicateTestHooks)

Disallow afterAll duplicacy inside the describe function.

Additional comments not posted (9)
apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (4)

19-19: Import of DelegationsIndexService added.

This import is necessary for the new feature to index delegations as described in the PR.


41-41: DelegationsIndexService injected into DelegationsController.

This is a good use of dependency injection, aligning with NestJS best practices.


49-49: Non-blocking call to indexDelegations.

Using void to ignore the promise is appropriate here as per the discussion in the PR, ensuring the operation does not block other processes.

Also applies to: 71-71


86-86: Parameter type updated to Array<AuthDelegationType>.

This change is consistent with the updated import and usage of AuthDelegationType instead of DelegationType.

apps/services/auth/ids-api/src/app/delegations/delegations.controller.spec.ts (5)

14-14: Import of DelegationsIndexService added.

This import is necessary for setting up the test environment for the new indexing feature.


59-59: Import of AuthDelegationType and AuthDelegationProvider.

These imports are necessary for the updated tests reflecting the changes in delegation types.


77-77: DelegationsIndexService initialized in test setup.

Proper initialization of services in tests is crucial for isolating test cases and ensuring they run correctly.

Also applies to: 129-129


228-228: Spy setup for indexDelegations.

Setting up spies is a good practice for testing that services are called as expected without performing actual operations.

Also applies to: 384-384, 914-914


513-513: Verification of delegation indexing.

These tests verify that the indexDelegations method is called, ensuring that the new feature is integrated correctly.

Also applies to: 1015-1015

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 af9f3d0 and 5bfc89a.

Files selected for processing (2)
  • apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (7 hunks)
  • apps/services/auth/ids-api/src/app/delegations/delegations.module.ts (2 hunks)
Additional context used
Path-based instructions (2)
apps/services/auth/ids-api/src/app/delegations/delegations.module.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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/services/auth/ids-api/src/app/delegations/delegations.controller.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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/services/auth/ids-api/src/app/delegations/delegations.controller.ts

[error] 41-41: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 52-52: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 70-70: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 71-74: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 96-96: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 97-97: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 98-101: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.

Additional comments not posted (10)
apps/services/auth/ids-api/src/app/delegations/delegations.module.ts (2)

10-10: Added import for logger and LOGGER_PROVIDER.

This addition is aligned with the PR's objective to enhance logging capabilities within the module.


21-23: Added a new provider for LOGGER_PROVIDER.

This change supports the enhanced logging capabilities by providing a logger instance to the module's providers. It's crucial to ensure that all parts of the application that require logging are updated to use this logger.

apps/services/auth/ids-api/src/app/delegations/delegations.controller.ts (8)

4-4: Added Inject import.

This is necessary for dependency injection of the logger in the controller, aligning with NestJS best practices.


13-14: Added imports for Logger and LOGGER_PROVIDER.

These imports are necessary for the logging functionality within the controller, ensuring that the logger can be injected and used.


22-22: Added import for DelegationsIndexService.

This service is crucial for the new feature of indexing delegations, as described in the PR summary.


31-31: Updated import from DelegationType to AuthDelegationType.

This change is necessary to reflect the updated method signatures and ensure type safety.


41-46: Injected the logger and DelegationsIndexService into the controller.

Proper use of dependency injection for the logger and the new indexing service. This setup is essential for the added functionality and adheres to NestJS's dependency injection patterns.

Tools
Biome

[error] 41-41: 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 the unsafeParameterDecoratorsEnabled option to true in your configuration file.


57-60: Non-blocking call to indexDelegations with error handling.

This implementation ensures that the main functionality is not delayed by the indexing process, and any errors during indexing are logged, maintaining robustness.


84-87: Similar non-blocking call pattern as in findAllToV1.

This is a repeat of the pattern used in findAllToV1, ensuring consistency across methods.


Line range hint 102-138: Handling of delegation types to fetch scopes.

The method correctly handles different delegation types to fetch appropriate scopes. This is a good use of conditional logic to ensure that only relevant scopes are fetched based on the delegation type.

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 5bfc89a and 94db003.

Files selected for processing (2)
  • apps/services/auth/ids-api/src/app/delegations/test/delegations-filters.spec.ts (4 hunks)
  • apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts (3 hunks)
Additional context used
Path-based instructions (2)
apps/services/auth/ids-api/src/app/delegations/test/delegations-filters.spec.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts (2)

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

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

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 (6)
apps/services/auth/ids-api/src/app/delegations/test/delegations-filters.spec.ts (3)

23-23: Initialization of DelegationsIndexService is correctly done using NestJS dependency injection.


33-33: Proper retrieval of DelegationsIndexService from the application context.


43-43: Mocking of indexDelegations method is appropriate for isolating test cases from external dependencies.

apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts (3)

95-95: Initialization of DelegationsIndexService is correctly done using NestJS dependency injection.


107-108: Mocking of indexDelegations method is appropriate for isolating test cases from external dependencies.


8-10: Ensure new imports are used effectively in the test suite.

Verification successful

The new imports DelegationsIndexService and DelegationType are effectively used in the test cases within delegations-scopes.spec.ts.

  • DelegationsIndexService is used in variable declarations and assignments.
  • DelegationType is used in multiple instances for defining delegation types.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that new imports are used in test cases.

# Test: Search for the usage of `DelegationsIndexService` and `DelegationType` in test cases. Expect: At least one usage.
rg --type typescript $'DelegationsIndexService|DelegationType' 'apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts'

Length of output: 177



Script:

#!/bin/bash
# Description: Verify that new imports are used in test cases.

# Test: Search for the usage of `DelegationsIndexService` and `DelegationType` in test cases. Expect: At least one usage.
rg --type ts $'DelegationsIndexService|DelegationType' 'apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts'

Length of output: 678

Copy link
Member

@GunnlaugurG GunnlaugurG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@Herdismaria Herdismaria added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Jun 5, 2024
@kodiakhq kodiakhq bot merged commit 9e1ff00 into main Jun 5, 2024
38 checks passed
@kodiakhq kodiakhq bot deleted the feat/index-delegations-when-selecting-account branch June 5, 2024 13:40
sigruntg pushed a commit that referenced this pull request Jun 12, 2024
* index delegations when IDS gets delegations

* fix tests

* don't fail requests if indexing fails

* mock delegation indexing in controller tests

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
lodmfjord pushed a commit that referenced this pull request Jun 14, 2024
* index delegations when IDS gets delegations

* fix tests

* don't fail requests if indexing fails

* mock delegation indexing in controller tests

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
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.

2 participants