-
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(endorsement-system): Store ownername #17248
Conversation
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options. WalkthroughThis pull request introduces a migration script to add an Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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
|
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/services/endorsements/api/src/app/modules/endorsementList/endorsementList.service.ts (1)
961-972
: Consider adding retry mechanism for NatReg API calls.The error handling is good, but NatReg API calls might fail due to transient issues. Consider implementing a retry mechanism with exponential backoff.
Example implementation:
private async fetchOwnerNameFromRegistry(nationalId: string): Promise<string> { + const maxRetries = 3; + const baseDelay = 1000; // 1 second + + for (let attempt = 1; attempt <= maxRetries; attempt++) { try { const person = await this.nationalRegistryApiV3.getName(nationalId) return person?.fulltNafn ? person.fulltNafn : '' } catch (error) { + if (attempt === maxRetries) { this.logger.error('Failed to fetch owner name from NationalRegistry', { error: error.message, nationalId, + attempt, }) return '' + } + + const delay = baseDelay * Math.pow(2, attempt - 1); + await new Promise(resolve => setTimeout(resolve, delay)); + + this.logger.warn('Retrying NatReg API call', { + nationalId, + attempt, + nextDelay: delay, + }); } + } + return ''; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/services/endorsements/api/migrations/20241216113500-add-ownerName-column.js
(1 hunks)apps/services/endorsements/api/src/app/modules/endorsementList/endorsementList.model.ts
(1 hunks)apps/services/endorsements/api/src/app/modules/endorsementList/endorsementList.service.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/services/endorsements/api/src/app/modules/endorsementList/endorsementList.model.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/endorsements/api/migrations/20241216113500-add-ownerName-column.js (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/endorsements/api/src/app/modules/endorsementList/endorsementList.service.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 (3)
apps/services/endorsements/api/migrations/20241216113500-add-ownerName-column.js (1)
1-12
: LGTM! Migration looks good.
The migration correctly adds a nullable ownerName
column and includes proper rollback functionality.
apps/services/endorsements/api/src/app/modules/endorsementList/endorsementList.model.ts (1)
88-94
: LGTM! Model property is well-defined.
The ownerName
property is properly decorated for both API documentation and database mapping, with appropriate nullability.
apps/services/endorsements/api/src/app/modules/endorsementList/endorsementList.service.ts (1)
250-254
: LGTM! Owner name fetching is properly integrated.
The create method correctly fetches and stores the owner name while maintaining existing functionality.
Datadog ReportAll test runs ✅ 14 Total Test Services: 0 Failed, 11 Passed Test ServicesThis report shows up to 10 services
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17248 +/- ##
========================================
Coverage 35.73% 35.74%
========================================
Files 6941 6937 -4
Lines 148407 148283 -124
Branches 42340 42324 -16
========================================
- Hits 53038 52998 -40
+ Misses 95369 95285 -84
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 30 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
…thub.com/island-is/island.is into endorsement-system/owner-name-nationalid
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
storing ownername to reduce unnecessary requests to NatReg
Attach a link to issue if relevant
What
Specify what you're trying to achieve
Why
Specify why you need to achieve this
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
ownerName
field in the endorsement list.Bug Fixes
Documentation