-
Notifications
You must be signed in to change notification settings - Fork 3
feat(PM-3317): Profile download API endpoint initial implementation #20
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
base: develop
Are you sure you want to change the base?
Conversation
|
|
||
| module.exports = { | ||
| generatePDF | ||
| } No newline at end of 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.
[💡 style]
Ensure that a newline is added at the end of the file. This is a common convention that can prevent issues with certain tools and version control systems.
| const awsConfig = { | ||
| s3: config.AMAZON.S3_API_VERSION, | ||
| // S3 Client configuration | ||
| const s3ClientConfig = { |
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.
[❗❗ correctness]
The s3ClientConfig object is missing the s3 key which was present in the previous awsConfig. Ensure that the S3 API version is correctly configured if required by the new SDK.
| } | ||
| // Upload to S3 | ||
| await getS3().upload(params).promise() | ||
| const upload = new Upload({ |
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.
[performance]
The Upload class from @aws-sdk/lib-storage is used here. Ensure that this library is compatible with the current AWS SDK version and that it handles large file uploads efficiently to avoid potential memory issues.
| callback(null, { Body: Buffer.from(photoContent) }) | ||
| }) | ||
| originalS3ClientSend = S3Client.prototype.send | ||
| S3Client.prototype.send = async function (command) { |
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.
[maintainability]
Overriding S3Client.prototype.send directly can lead to issues if other tests or parts of the code rely on the original behavior. Consider using a mocking library like sinon to stub this method instead, which can provide better control and restore functionality.
| callback(null) | ||
| }) | ||
| // Mock Upload class's done method for upload operations | ||
| originalUpload = Upload.prototype.done |
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.
[maintainability]
Overriding Upload.prototype.done directly can lead to issues if other tests or parts of the code rely on the original behavior. Consider using a mocking library like sinon to stub this method instead, which can provide better control and restore functionality.
What's in this PR?
Screenshot
OOM error