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

fix: type fix for s3-file-service #394

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions backend/core/src/shared/uploads/aws/amazon-s3-file-service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { BaseFileService } from "../base-file-service"
import { ConfigInvalidEnumError, ConfigItemMissingError } from "../errors"
import { FileUpload, FileServiceConfig, FileService } from "../types"
import { S3Client, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3"
import {
S3Client,
PutObjectCommand,
GetObjectCommand,
StorageClass,
PutObjectCommandInput,
} from "@aws-sdk/client-s3"
import { getSignedUrl } from "@aws-sdk/s3-request-presigner"

enum UrlFormats {
Expand Down Expand Up @@ -70,7 +76,7 @@ export class AmazonS3FileService extends BaseFileService implements FileService
const rand = Math.round(Math.random() * 1000000)
const path = `${prefix}/${rand}/${key}/${file.name}`

const request = {
const request: PutObjectCommandInput = {
Bucket: this.bucket,
Key: path,
Body: file.contents,
Expand All @@ -79,7 +85,7 @@ export class AmazonS3FileService extends BaseFileService implements FileService

// The storage class to use
// Could be an option later, but hardcode as STANDARD for now
StorageClass: "STANDARD",
StorageClass: StorageClass.STANDARD,
}

// We don't need the response
Expand Down
Loading