-
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(admin-api): Get delegation providers #14943
Conversation
…etMany personal representatives
WalkthroughThe changes introduce a new module, Changes
Tip Early Access Features
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: 4
Outside diff range and nitpick comments (2)
apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (2)
Line range hint
131-135
: Refactor to usefor...of
instead offorEach
for better performance and readability.- testcase.apiScopes.forEach((scope) => factory.createApiScope(scope)) + for (const scope of testcase.apiScopes) { + factory.createApiScope(scope) + } - testcase.expectedTo?.forEach((id) => expect(testCase.expectedTo?.includes(id)).toBe(true)) + for (const id of testCase.expectedTo ?? []) { + expect(testCase.expectedTo?.includes(id)).toBe(true) + }Also applies to: 142-146
Line range hint
157-163
: Remove duplicateafterAll
hooks to prevent unintended side effects and ensure clean test teardown.- afterAll(async () => { - await app.cleanUp() - })Also applies to: 165-167
Review Details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (11)
- apps/services/auth/admin-api/src/app/app.module.ts (2 hunks)
- apps/services/auth/admin-api/src/app/v2/providers/providers.controller.ts (1 hunks)
- apps/services/auth/admin-api/src/app/v2/providers/providers.module.ts (1 hunks)
- apps/services/auth/admin-api/src/app/v2/providers/test/provider-controller.spec.ts (1 hunks)
- apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (1 hunks)
- libs/auth-api-lib/src/index.ts (2 hunks)
- libs/auth-api-lib/src/lib/delegations/delegation-provider.service.ts (1 hunks)
- libs/auth-api-lib/src/lib/delegations/delegations.module.ts (2 hunks)
- libs/auth-api-lib/src/lib/delegations/dto/delegation-provider.dto.ts (1 hunks)
- libs/auth-api-lib/src/lib/delegations/dto/paginated-delegation-provider.dto.ts (1 hunks)
- libs/auth-api-lib/src/lib/delegations/models/delegation-provider.model.ts (2 hunks)
Files skipped from review due to trivial changes (2)
- apps/services/auth/admin-api/src/app/app.module.ts
- libs/auth-api-lib/src/lib/delegations/dto/delegation-provider.dto.ts
Additional Context Used
Biome (21)
apps/services/auth/admin-api/src/app/v2/providers/providers.controller.ts (4)
38-38: Decorators are not valid here.
1-8: Some named imports are only used as types.
11-15: Some named imports are only used as types.
15-16: All these imports are only used as types.
apps/services/auth/admin-api/src/app/v2/providers/test/provider-controller.spec.ts (3)
96-105: Prefer for...of instead of forEach.
1-1: Some named imports are only used as types.
3-7: Some named imports are only used as types.
apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (9)
131-135: Prefer for...of instead of forEach.
142-146: Prefer for...of instead of forEach.
157-163: Disallow duplicate setup and teardown hooks.
165-167: Disallow duplicate setup and teardown hooks.
2-3: All these imports are only used as types.
3-4: All these imports are only used as types.
5-6: Some named imports are only used as types.
7-8: All these imports are only used as types.
9-14: Some named imports are only used as types.
libs/auth-api-lib/src/lib/delegations/delegation-provider.service.ts (3)
10-10: Decorators are not valid here.
12-12: Decorators are not valid here.
2-3: All these imports are only used as types.
libs/auth-api-lib/src/lib/delegations/dto/paginated-delegation-provider.dto.ts (1)
2-3: All these imports are only used as types.
libs/auth-api-lib/src/lib/delegations/models/delegation-provider.model.ts (1)
16-17: All these imports are only used as types.
Path-based Instructions (9)
apps/services/auth/admin-api/src/app/v2/providers/providers.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."
libs/auth-api-lib/src/lib/delegations/dto/paginated-delegation-provider.dto.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."
libs/auth-api-lib/src/lib/delegations/delegation-provider.service.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."
libs/auth-api-lib/src/lib/delegations/models/delegation-provider.model.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/services/auth/admin-api/src/app/v2/providers/providers.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/admin-api/src/app/v2/providers/test/provider-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."
libs/auth-api-lib/src/lib/delegations/delegations.module.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/services/auth/delegation-api/src/app/delegations/test/delegations-controller/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."
libs/auth-api-lib/src/index.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
Additional comments not posted (11)
apps/services/auth/admin-api/src/app/v2/providers/providers.module.ts (1)
1-13
: The module setup looks correct and adheres to NestJS best practices for module configuration.libs/auth-api-lib/src/lib/delegations/dto/paginated-delegation-provider.dto.ts (1)
1-16
: The DTO definitions are well-structured and correctly use validation and documentation decorators.libs/auth-api-lib/src/lib/delegations/delegation-provider.service.ts (1)
1-37
: The service logic for fetching delegation providers is implemented correctly and follows best practices for asynchronous operations and data mapping.libs/auth-api-lib/src/lib/delegations/models/delegation-provider.model.ts (1)
Line range hint
1-63
: The model definition and thetoDTO
method are correctly implemented, adhering to best practices for ORM models and data transformation.apps/services/auth/admin-api/src/app/v2/providers/providers.controller.ts (2)
1-49
: The controller logic is well-implemented, with clear and secure handling of API requests and responses.
1-49
: Correct the usage of decorators for parameter decoration, which are incorrectly placed according to the static analysis.- @CurrentAuth() auth: Auth, + @CurrentAuth() auth: AuthLikely invalid or redundant comment.
apps/services/auth/admin-api/src/app/v2/providers/test/provider-controller.spec.ts (1)
1-112
: The test coverage is comprehensive and well-structured, effectively validating the functionality and security of the providers endpoint.libs/auth-api-lib/src/lib/delegations/delegations.module.ts (2)
77-77
: Check ifDelegationProviderService
is correctly exported and used elsewhere in the application.Verification successful
The
DelegationProviderService
is correctly imported and used in multiple locations within the application, includingdelegations.module.ts
,providers.module.ts
, andproviders.controller.ts
.
libs/auth-api-lib/src/lib/delegations/delegations.module.ts
libs/auth-api-lib/src/lib/delegations/delegation-provider.service.ts
apps/services/auth/admin-api/src/app/v2/providers/providers.module.ts
apps/services/auth/admin-api/src/app/v2/providers/providers.controller.ts
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `DelegationProviderService` across the application. # Test: Search for the usage of `DelegationProviderService`. Expect: Correct usage in other modules or services. rg --type typescript $'DelegationProviderService'Length of output: 83
Script:
#!/bin/bash # Description: Verify the usage of `DelegationProviderService` across the application. # Test: Search for the usage of `DelegationProviderService`. Expect: Correct usage in other modules or services. rg --type ts 'DelegationProviderService'Length of output: 929
33-33
: EnsureDelegationProviderService
is properly imported from its file.apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (1)
23-46
: Ensure the data structure ofdelegationProviderTypesData
matches expected types and fields used in tests.Verification successful
The data structure of
delegationProviderTypesData
matches the expected format and is correctly used in the test assertions and loops.
provider-controller.spec.ts
:
- Loops through
delegationProviderTypesData
and itsdelegationTypes
.- Asserts the length of
delegationProviderTypesData
and its elements.
delegations.controller.spec.ts
:
- Defines
delegationProviderTypesData
with the expected structure.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the data structure of `delegationProviderTypesData`. # Test: Search for the usage of `delegationProviderTypesData` in test assertions. Expect: Correct usage matching the data structure. rg --type typescript $'delegationProviderTypesData'Length of output: 85
Script:
#!/bin/bash # Description: Verify the data structure of `delegationProviderTypesData`. # Test: Search for the usage of `delegationProviderTypesData` in test assertions. Expect: Correct usage matching the data structure. rg --type ts 'delegationProviderTypesData'Length of output: 949
Script:
#!/bin/bash # Description: Extract relevant lines involving `delegationProviderTypesData` for detailed inspection. # Extract lines from `provider-controller.spec.ts` rg --type ts --context 5 'delegationProviderTypesData' apps/services/auth/admin-api/src/app/v2/providers/test/provider-controller.spec.ts # Extract lines from `delegations.controller.spec.ts` rg --type ts --context 5 'delegationProviderTypesData' apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.tsLength of output: 1669
libs/auth-api-lib/src/index.ts (1)
Line range hint
34-46
: Confirm that all newly exported entities are correctly implemented and used elsewhere in the application.Verification successful
The newly exported entities
DelegationProviderService
,DelegationProviderDto
, andPaginatedDelegationProviderDto
are correctly implemented and used in various parts of the codebase.
DelegationProviderService
is implemented inlibs/auth-api-lib/src/lib/delegations/delegation-provider.service.ts
and used inlibs/auth-api-lib/src/lib/delegations/delegations.module.ts
andapps/services/auth/admin-api/src/app/v2/providers/providers.controller.ts
.DelegationProviderDto
is implemented inlibs/auth-api-lib/src/lib/delegations/dto/delegation-provider.dto.ts
and used inlibs/auth-api-lib/src/lib/delegations/models/delegation-provider.model.ts
andapps/services/auth/admin-api/src/app/v2/providers/test/provider-controller.spec.ts
.PaginatedDelegationProviderDto
is implemented inlibs/auth-api-lib/src/lib/delegations/dto/paginated-delegation-provider.dto.ts
and used inlibs/auth-api-lib/src/lib/delegations/delegation-provider.service.ts
andapps/services/auth/admin-api/src/app/v2/providers/providers.controller.ts
.These findings confirm that the newly exported entities are properly implemented and utilized within the application.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of newly exported entities. # Test: Search for the implementation and usage details of newly exported entities. Expect: Proper implementation and usage. rg --type typescript $'DelegationProviderService|DelegationProviderDto|PaginatedDelegationProviderDto'Length of output: 138
Script:
#!/bin/bash # Description: Verify the implementation and usage of newly exported entities. # Test: Search for the implementation and usage details of newly exported entities. Expect: Proper implementation and usage. rg --type ts 'DelegationProviderService|DelegationProviderDto|PaginatedDelegationProviderDto'Length of output: 2788
libs/auth-api-lib/src/lib/delegations/dto/paginated-delegation-provider.dto.ts
Show resolved
Hide resolved
apps/services/auth/admin-api/src/app/v2/providers/test/provider-controller.spec.ts
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14943 +/- ##
==========================================
+ Coverage 37.07% 37.10% +0.03%
==========================================
Files 6355 6358 +3
Lines 129527 129553 +26
Branches 36987 36984 -3
==========================================
+ Hits 48016 48070 +54
+ Misses 81511 81483 -28 Flags with carried forward coverage won't be shown. Click here to find out more.
... and 25 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 14 Total Test Services: 0 Failed, 14 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (1)
|
What
GET /providers endpoint in AdminApi that returns DelegationProviders and their DelegationTypes
Why
So we can display it in the ids-admin portal
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation
Refactor