-
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(parental-leave): pdf attachments not uploading #17114
fix(parental-leave): pdf attachments not uploading #17114
Conversation
WalkthroughThe changes introduce a new method Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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. 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
🧹 Outside diff range and nitpick comments (2)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (2)
406-421
: Consider performance optimization and naming conventionThe method effectively handles multiple PDF attachments, but consider these improvements:
- Use
Promise.all
for parallel processing of PDFs- Follow consistent camelCase naming (getPdfs instead of getPDFs)
Here's the suggested implementation:
- async getPDFs( + async getPdfs( application: Application, documents: Files[], attachmentType: string, fileUpload: string, ) { - const PDFs = [] - for (const index of documents.keys()) { - const pdf = await this.getPdf(application, index, fileUpload) - PDFs.push({ - attachmentType, - attachmentBytes: pdf, - }) - } - return PDFs + const pdfPromises = Array.from(documents.keys()).map(async (index) => { + const pdf = await this.getPdf(application, index, fileUpload) + return { + attachmentType, + attachmentBytes: pdf, + } + }) + return Promise.all(pdfPromises) }
454-459
: LGTM! Consistent implementation of PDF handlingThe refactoring effectively reduces code duplication by utilizing the new
getPDFs
method. The implementation is consistent across different types of attachments.Update the method calls to use the suggested camelCase naming convention (
getPdfs
) if you implement the previous suggestion.Also applies to: 465-470, 477-482
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts
(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.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."
📓 Learnings (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (1)
Learnt from: HjorturJ
PR: island-is/island.is#16281
File: libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts:398-398
Timestamp: 2024-11-12T15:15:11.835Z
Learning: In the `ParentalLeaveService`, the `getPdf` method returns a base64 encoded string, and this return type remains unchanged even after updating the implementation to use `awsService.getFileContent`.
🔇 Additional comments (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (1)
38-38
: LGTM!
The import of the Files
type is correctly placed and follows the existing import structure.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17114 +/- ##
==========================================
- Coverage 35.74% 35.57% -0.18%
==========================================
Files 6937 6921 -16
Lines 148171 148096 -75
Branches 42253 42211 -42
==========================================
- Hits 52969 52684 -285
- Misses 95202 95412 +210
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 185 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 3 Total Test Services: 0 Failed, 3 Passed Test Services
|
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 👍
Fix parental-leave pdf attachemnts not uploading
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