Skip to content
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

CB2-14227: Update cert-gen to remove snowball SQS pattern #191

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

me-matt
Copy link
Contributor

@me-matt me-matt commented Sep 30, 2024

Update cert-gen to remove snowball SQS pattern

Refactored the entry point handler to be more SOLID. The return type has been updated to include partial batch failures.

CB2-14227

Checklist

  • Branch is rebased against the latest develop/common
  • Necessary id required prepended with "test-" have been checked with automation testers and added
  • Code and UI has been tested manually after the additional changes
  • PR title includes the JIRA ticket number
  • Squashed commits contain the JIRA ticket number
  • Link to the PR added to the repo
  • Delete branch after merge

naathanbrown
naathanbrown previously approved these changes Sep 30, 2024
@@ -1,57 +1,26 @@
import { DeleteObjectCommandOutput, PutObjectCommandOutput } from '@aws-sdk/client-s3';
import { Callback, Context, Handler, SQSEvent, SQSRecord } from 'aws-lambda';
import { Callback, Context, Handler, SQSBatchItemFailure, SQSBatchResponse, SQSEvent, SQSRecord } from 'aws-lambda';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this unused import please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

return this.certificateUploadService.removeCertificate(testResult);
}

private async create(testResult: ITestResult): Promise<PutObjectCommandOutput> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be personal preference and appreciate it is the same amount of code, but I think as a team we we are trying to move away from .then / .catch in favour of using awaits, for readability.

  const response: IGeneratedCertificateResponse = await this.certificateGenerationService.generateCertificate(testResult);
  return this.certificateUploadService.uploadCertificate(response);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah absolutely in favour of removing promises +1

@@ -68,7 +68,8 @@
"node-yaml": "^4.0.1",
"reflect-metadata": "^0.1.13",
"ts-node-register": "^1.0.0",
"typedi": "^0.10.0"
"typedi": "^0.10.0",
"uuid": "^10.0.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node ships a randomUUID method via the crypto module - are we able to use that and reduce an extra dependency and dev dep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was using uuid just for validation so we didn't need to include manual regexs. Happy for alternatives though

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, if we are using it to validate an already existing value, then this is fine 👍

matthew2564
matthew2564 previously approved these changes Oct 1, 2024
@me-matt me-matt dismissed stale reviews from matthew2564 and naathanbrown via e9f04eb October 1, 2024 09:20
@me-matt me-matt merged commit 3dbac3d into develop Oct 1, 2024
7 checks passed
@me-matt me-matt deleted the feature/CB2-14227 branch October 1, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants