-
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(auth-admin): Delegation domain name changes #16013
Conversation
WalkthroughThis pull request introduces changes to the Changes
Possibly related PRs
Suggested labels
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 using PR comments)
Other keywords and placeholders
Documentation and Community
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16013 +/- ##
==========================================
- Coverage 36.73% 36.68% -0.05%
==========================================
Files 6735 6722 -13
Lines 138279 138257 -22
Branches 39318 39384 +66
==========================================
- Hits 50797 50721 -76
- Misses 87482 87536 +54
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 139 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 13 Total Test Services: 0 Failed, 13 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (2) |
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
Outside diff range and nitpick comments (2)
libs/auth-api-lib/migrations/20240915135625-delegation-allow-null-domain_name.js (1)
1-1
: Remove the redundant'use strict'
directive.The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it. The
'use strict'
directive is redundant and can be safely removed.Apply this diff to remove the redundant directive:
-'use strict'
Tools
Biome
[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)
libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (1)
Line range hint
97-103
: Remove the duplicatereferenceId
property definition.The
referenceId
property is defined twice in the code (lines 87-95 and 97-103). Having duplicate property definitions can lead to confusion and potential errors.Please remove the duplicate definition:
- /** - * ReferenceId is a field for storing a reference to the zendesk ticket id - */ - @Column({ - type: DataType.STRING, - allowNull: true, - unique: true, - }) - referenceId?: string
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- libs/auth-api-lib/migrations/20240915135625-delegation-allow-null-domain_name.js (1 hunks)
- libs/auth-api-lib/src/lib/delegations/admin/delegation-admin-custom.service.ts (1 hunks)
- libs/auth-api-lib/src/lib/delegations/delegations-outgoing.service.ts (4 hunks)
- libs/auth-api-lib/src/lib/delegations/delegations.service.ts (3 hunks)
- libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (2 hunks)
- libs/auth-api-lib/src/lib/resources/delegation-resources.service.ts (5 hunks)
Additional context used
Path-based instructions (6)
libs/auth-api-lib/migrations/20240915135625-delegation-allow-null-domain_name.js (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.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."
libs/auth-api-lib/src/lib/delegations/admin/delegation-admin-custom.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/resources/delegation-resources.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/delegations-outgoing.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/delegations.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."
Biome
libs/auth-api-lib/migrations/20240915135625-delegation-allow-null-domain_name.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 not posted (15)
libs/auth-api-lib/migrations/20240915135625-delegation-allow-null-domain_name.js (2)
4-23
: LGTM!The
up
function correctly modifies thedelegation
table to allow NULL values in thedomain_name
column and creates a new unique index to maintain data integrity. The use of a transaction ensures that the changes are applied atomically.
25-44
: LGTM!The
down
function correctly reverts the changes made by theup
function, restoring the original state of thedelegation
table. The use of a transaction ensures that the changes are applied atomically.libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (3)
31-36
: LGTM!The unique index is correctly defined and will enhance data integrity by preventing duplicate entries for the same delegation scenario. It will also improve query performance for queries that rely on the uniqueness of the indexed columns.
82-85
: Verify the impact of making thedomainName
field optional.The changes to make the
domainName
field optional are implemented correctly. This will allow for more flexibility in cases where a domain name is not applicable.However, please ensure that:
- Existing code that relies on the presence of the
domainName
field is updated to handle the optional nature of the field.- Existing data in the
delegation
table is migrated properly to handle null values for thedomainName
field.
87-95
: LGTM!The new
referenceId
property is correctly defined as an optional and unique field. This will facilitate better tracking and management of support tickets related to delegations.libs/auth-api-lib/src/lib/delegations/admin/delegation-admin-custom.service.ts (1)
109-109
: LGTM!The use of the nullish coalescing operator (
??
) to conditionally setdelegation.domainName
tonull
when it isundefined
is a good practice. It ensures that thefindScopes
method receives a consistent value, preventing potential issues from passingundefined
. This change enhances the robustness of the code without altering the overall logic flow.libs/auth-api-lib/src/lib/resources/delegation-resources.service.ts (5)
139-139
: Ensure proper handling of thenull
case and update method callers.The change to allow
null
fordomainName
aligns with the PR objective. Please ensure that:
- The
findScopesInternal
method called withinfindScopes
handles the case whendomainName
isnull
.- All callers of the
findScopes
method are updated to handle the newstring | null
type fordomainName
.
170-170
: Ensure proper handling of thenull
case and update method callers.The change to allow
null
fordomainName
aligns with the PR objective. Please ensure that:
- The
findScopesInternal
method called withinfindScopeNames
handles the case whendomainName
isnull
.- All callers of the
findScopeNames
method are updated to handle the newstring | null
type fordomainName
.
184-184
: Ensure proper handling of thenull
case and update method callers.The change to allow
null
fordomainName
aligns with the PR objective. Please ensure that:
- The
findScopeNames
method called withinvalidateScopeAccess
handles the case whendomainName
isnull
.- All callers of the
validateScopeAccess
method are updated to handle the newstring | null
type fordomainName
.
240-240
: Handle thenull
case in thewhere
clause.The change to allow
null
fordomainName
aligns with the PR objective. Please ensure that thewhere
clause in thefindAll
call within thefindScopesInternal
method handles the case whendomainName
isnull
.
Line range hint
1-400
: Adherence to additional instructions:
- Reusability of components and hooks across different NextJS apps: Not applicable, as this is a NestJS service.
- TypeScript usage for defining props and exporting types: The code adheres to this by using TypeScript for defining types and method signatures.
- Effective tree-shaking and bundling practices: Not directly observable in this code.
libs/auth-api-lib/src/lib/delegations/delegations-outgoing.service.ts (2)
345-345
: LGTM!The use of the nullish coalescing operator (
??
) to defaultcurrentDelegation.domainName
tonull
when it's undefined is a good practice. It ensures a consistent value is passed to thevalidateScopeAccess
function, improving the reliability of the delegation logic.
406-406
: Looks good!Using the nullish coalescing operator (
??
) to defaultdelegation.domainName
tonull
when it's undefined is a good practice. It ensures a consistent value is passed to thefindScopes
function, improving the reliability of the delegation logic.libs/auth-api-lib/src/lib/delegations/delegations.service.ts (2)
139-139
: Approved: Explicit handling of undefined or nulldomainName
.The change from
delegation.domainName
todelegation.domainName ?? null
is a good practice. It ensures that thefindScopeNames
method receives an explicitnull
value instead of potentially receivingundefined
whendomainName
is not defined.Using the nullish coalescing operator
??
provides a fallback value and enhances the robustness of the code by clarifying the intent.
159-159
: Approved: Enhanced documentation clarity.Adding the
direction
parameter to thedelete
method's documentation is a good improvement. It clarifies that the method can handle both incoming and outgoing delegations.Specifying the possible values of
direction
(incoming or outgoing) helps developers understand the purpose and usage of the method more easily.Enhancing the documentation in this way improves the overall clarity and maintainability of the codebase.
What
Make
domain_name
in delegation table optional and remove default valueWhy
So we can offer general mandate (Allsherjarumboð) delegation that is not domain specific
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
domainName
to allow for null values, improving flexibility in delegation scenarios.referenceId
property for tracking Zendesk tickets related to delegations.Bug Fixes
domainName
values across various services.Documentation
direction
parameter in thedelete
method.