-
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
fix(auth-api-lib): Use company registry api to get company name on custom delegations. #15199
fix(auth-api-lib): Use company registry api to get company name on custom delegations. #15199
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant DelegationsIncomingCustomService
participant CompanyRegistryClientService
participant IndividualService
Client->>DelegationsIncomingCustomService: getDelegations()
alt Fetching Company Info
DelegationsIncomingCustomService->>CompanyRegistryClientService: getCompanyInfo()
CompanyRegistryClientService-->>DelegationsIncomingCustomService: Company Info
end
alt Fetching Individual Info
DelegationsIncomingCustomService->>IndividualService: getIndividualInfo()
IndividualService-->>DelegationsIncomingCustomService: Individual Info
end
DelegationsIncomingCustomService-->>Client: { delegations, fromNameInfo }
sequenceDiagram
participant Client
participant DelegationsIncomingCustomService
participant CompanyRegistryClientService
participant IndividualService
Client->>DelegationsIncomingCustomService: getDelegationsByNationalIds()
alt Fetching Company Info
DelegationsIncomingCustomService->>CompanyRegistryClientService: getCompanyInfo()
CompanyRegistryClientService-->>DelegationsIncomingCustomService: Company Info
end
alt Fetching Individual Info
DelegationsIncomingCustomService->>IndividualService: getIndividualInfo()
IndividualService-->>DelegationsIncomingCustomService: Individual Info
end
DelegationsIncomingCustomService-->>Client: { aliveDelegations, deceasedDelegations, fromNameInfo }
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: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- libs/auth-api-lib/src/lib/delegations/delegations-incoming-custom.service.ts (9 hunks)
Additional context used
Path-based instructions (1)
libs/auth-api-lib/src/lib/delegations/delegations-incoming-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."
Biome
libs/auth-api-lib/src/lib/delegations/delegations-incoming-custom.service.ts
[error] 50-51: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 52-53: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 56-57: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
Additional comments not posted (8)
libs/auth-api-lib/src/lib/delegations/delegations-incoming-custom.service.ts (8)
11-14
: Added imports forCompanyExtendedInfo
andCompanyRegistryClientService
to support the new functionality of fetching company data.
38-41
: Introduced a new typeFromNameInfo
to standardize the structure of name information returned by methods. This is a good practice as it enhances code readability and maintainability.
255-255
: The methodgetLiveStatusFromDelegations
now also returnsFromNameInfo[]
, which is consistent with the new data handling strategy. This is a good update for maintaining a uniform interface across related methods.
[APROVED]
267-287
: The error handling in thegetLiveStatusFromDelegations
method has been updated to catch errors from bothcompanyRegistryClient
andnationalRegistryClient
. This is crucial for robustness, especially given the different data sources involved.
324-324
: The methodhandlerGetError
is used to handle errors uniformly across different service calls. This centralization of error handling is a good practice as it simplifies maintenance and ensures consistency.
339-342
: The methodgetPersonByNationalId
efficiently finds a person's information by their national ID from a list ofFromNameInfo
. This utility function is well-implemented and crucial for the functionality of the service.
55-55
: AddedcompanyRegistryClient
to the constructor to facilitate company data retrieval. Ensure that this service is properly instantiated and injected where this class is used.
160-160
: The methodfindAllIncoming
now returnsFromNameInfo[]
instead ofIndividualDto[]
, aligning with the new data structure. This change should be reflected wherever this method's output is consumed.
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.
⚡
Add infra to auth apis using the delegation module -> companyregistryclientmodule
13d2445
to
02c30be
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15199 +/- ##
==========================================
- Coverage 37.04% 37.04% -0.01%
==========================================
Files 6538 6538
Lines 133124 133117 -7
Branches 38128 38124 -4
==========================================
- Hits 49318 49311 -7
Misses 83806 83806
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 16 Total Test Services: 0 Failed, 16 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (7)
|
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.
LGTM
…stom delegations. (#15199) * Use company registry api to get company name on custom delegations. * Add dependency on CompanyRegstiryClientModule. Add infra to auth apis using the delegation module -> companyregistryclientmodule * Fix name property on þjóðskrá identity. --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
…stom delegations. (#15199) * Use company registry api to get company name on custom delegations. * Add dependency on CompanyRegstiryClientModule. Add infra to auth apis using the delegation module -> companyregistryclientmodule * Fix name property on þjóðskrá identity. --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
What
Use company registry api to get company names to get up-to-date name.
Why
Companies can change names and then all old delegations will display the old name.
** BUT ** we can either manually update delegations in the DB or communicate to the users to remove the delegation and grant it again.
Screenshots / Gifs
N/A
Checklist:
Summary by CodeRabbit