Skip to content

Commit

Permalink
Merge pull request #19 from Gavant/add-bucket-and-key-response
Browse files Browse the repository at this point in the history
  • Loading branch information
napafundi authored Nov 30, 2022
2 parents 19e0ae3 + 62a4751 commit 413f58a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/requests/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class PdfGenerationRequestHandler {
const storageRequest = this.getPdfStorageRequest(path);
const pdfUrl = await new S3PdfStorageService().store(storageRequest);
console.log('Pdf stored on S3');
return PdfGenerationResponseAdapter.toCreated(pdfUrl);
return PdfGenerationResponseAdapter.toCreated(pdfUrl, storageRequest);
}

/**
Expand Down
9 changes: 7 additions & 2 deletions src/responses/response-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { PDF_STORAGE_BUCKET_NAME } from '../config';
import PdfStorageRequest from '../requests/storage-request';

export default class PdfGenerationResponseAdapter {
static toCreated(pdfUrl: string) {
static toCreated(pdfUrl: string, storageRequest: PdfStorageRequest) {
return {
url: pdfUrl
url: pdfUrl,
bucket: PDF_STORAGE_BUCKET_NAME,
key: `${storageRequest.storageFilePath}/${storageRequest.fileName}`
};
}
}

0 comments on commit 413f58a

Please sign in to comment.