-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from DSM-Repo/library
pr: file 업로드 로직 재작성
- Loading branch information
Showing
7 changed files
with
51 additions
and
155 deletions.
There are no files selected for viewing
This file contains 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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/example/whopper/application/file/impl/FileUploadService.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.example.whopper.application.file.impl; | ||
|
||
import com.example.whopper.common.exception.file.PdfUploadFailedException; | ||
import com.example.whopper.infrastructure.aws.s3.AwsS3Properties; | ||
import io.awspring.cloud.s3.ObjectMetadata; | ||
import io.awspring.cloud.s3.S3Operations; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
class FileUploadService { | ||
|
||
private final S3Operations s3Operations; | ||
private final AwsS3Properties s3Properties; | ||
|
||
void uploadFile(MultipartFile multipartFile, String key) { | ||
try { | ||
s3Operations.upload( | ||
s3Properties.bucket(), | ||
key, | ||
multipartFile.getInputStream(), | ||
ObjectMetadata.builder() | ||
.contentType(multipartFile.getContentType()) | ||
.build() | ||
); | ||
} catch (Exception e) { | ||
throw PdfUploadFailedException.EXCEPTION; | ||
} | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
15 changes: 0 additions & 15 deletions
15
src/main/java/com/example/whopper/infrastructure/aws/AwsProperties.java
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
src/main/java/com/example/whopper/infrastructure/aws/s3/AwsS3Config.java
This file was deleted.
Oops, something went wrong.
This file contains 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