feat(backend-sep12): GCS StorageProvider, UploadRecord schema, MIME validation & mock SMTP tests#667
Open
vic-Gray wants to merge 2 commits into
Conversation
…e validation & mock SMTP tests - feat(backend-sep12): [sep-12] implement gcs storageprovider (closes ceejaylaboratory#545) - feat(backend-sep12): [sep-12] add upload_record schema to prisma (closes ceejaylaboratory#547) - feat(backend-sep12): [sep-12] add content type allowlist validation for upload requests (closes ceejaylaboratory#550) - feat(backend-tests): add mock smtp server for local backend testing (closes ceejaylaboratory#541)
…age-upload-record-mime-validation-smtp
|
@vic-Gray Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements four related backend issues in the
backend-sep12andbackend-testscomponent scopes.Changes
#545 — [SEP-12] Implement GCS StorageProvider (closes #545)
@google-cloud/storage: ^7.9.0tobackend/package.jsonStorageProviderinterface (src/services/storage/storage.provider.ts)getSignedUploadUrl(key, mimeType, expiresIn?): Promise<string>GcsStorageProviderimplementing the interface (src/services/storage/gcs.storage.provider.ts)action: 'write', default TTL 900 sStorageclient injectable for easy unit-testingsrc/services/storage/index.ts#547 — [SEP-12] Add UploadRecord Schema to Prisma (closes #547)
UploadStatusenum (PENDING | COMPLETED | EXPIRED) tobackend/prisma/schema.prismaUploadRecordmodel with fields:id,account,fieldName,storageKey,status,expiresAt,createdAt,updatedAtaccountandstatus#550 — [SEP-12] Add Content-Type Allowlist Validation (closes #550)
ALLOWED_MIME_TYPESset fromsrc/api/routes/sep12.route.ts:image/jpeg,image/png,image/webp,application/pdffileFilter— rejects disallowed types viaMulterError#541 — Add Mock SMTP Server for Local Backend Testing (closes #541)
nodemailer-mock: ^2.0.5todevDependenciessrc/services/admin-email.service.test.tswith 7 unit tests:toandfromaddressesTesting
Files Changed
backend/package.json@google-cloud/storagedep,nodemailer-mockdevDepbackend/prisma/schema.prismaUploadStatusenum +UploadRecordmodelbackend/src/api/routes/sep12.route.tsbackend/src/services/storage/storage.provider.tsStorageProviderinterfacebackend/src/services/storage/gcs.storage.provider.tsGcsStorageProviderbackend/src/services/storage/index.tsbackend/src/services/admin-email.service.test.ts