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

[Chore] #268 - PreSignedUrl DTO 네이밍 변경 #273

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/main/java/shop/cazait/domain/s3/api/S3ApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import shop.cazait.domain.s3.dto.GetPreSignedUrlRes;
import shop.cazait.domain.s3.dto.response.PreSignedUrlCreateOutDTO;
import shop.cazait.domain.s3.service.S3Service;
import shop.cazait.global.common.dto.response.SuccessResponse;
import shop.cazait.global.config.encrypt.NoAuth;
Expand All @@ -26,7 +26,7 @@ public class S3ApiController {
@GetMapping("/pre-signed")
@Operation(summary = "미리 서명된 주소 생성", description = "이미지 업로드를 위해 필요한 미리 서명된 주소를 받는다.")
@Parameter(name = "directory", description = "이미지 종류", example = "cafe")
public SuccessResponse<GetPreSignedUrlRes> createPreSignedUrl(@RequestParam String directory) {
public SuccessResponse<PreSignedUrlCreateOutDTO> createPreSignedUrl(@RequestParam String directory) {
return new SuccessResponse<>(SuccessStatus.SUCCESS, s3Service.createPreSignedUrl(directory));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package shop.cazait.domain.s3.dto;
package shop.cazait.domain.s3.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;

@Schema(description = "이미지 업로드 Response : 미리 서명된 주소를 받아 이미지 업로드")
@Schema(name = "이미지 업로드 Response", description = "미리 서명된 주소를 받아 이미지 업로드")
@Getter
@Builder(access = AccessLevel.PROTECTED)
public class GetPreSignedUrlRes {
public class PreSignedUrlCreateOutDTO {

@Schema(description = "이미지 객체 Key", example = "cafe/caab93eb-e9ed-499e-be61-15cfa1069f73")
String objectKey;
@Schema(description = "미리 서명된 URL")
String preSignedUrl;

public static GetPreSignedUrlRes of(String objectKey, String preSignedUrl) {
return GetPreSignedUrlRes.builder()
public static PreSignedUrlCreateOutDTO of(String objectKey, String preSignedUrl) {
return PreSignedUrlCreateOutDTO.builder()
.objectKey(objectKey)
.preSignedUrl(preSignedUrl)
.build();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/shop/cazait/domain/s3/service/S3Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import shop.cazait.domain.s3.dto.GetPreSignedUrlRes;
import shop.cazait.domain.s3.dto.response.PreSignedUrlCreateOutDTO;

@Slf4j
@Service
Expand All @@ -26,7 +26,7 @@ public class S3Service {
/**
* Pre-Signed Url 생성
*/
public GetPreSignedUrlRes createPreSignedUrl(String directory) {
public PreSignedUrlCreateOutDTO createPreSignedUrl(String directory) {

String objectKey = directory + "/" + UUID.randomUUID().toString();
log.info(objectKey);
Expand All @@ -47,7 +47,7 @@ public GetPreSignedUrlRes createPreSignedUrl(String directory) {
URL preSignedUrl = amazonS3.generatePresignedUrl(generatePresignedUrlRequest);

log.info("Pre-Signed URL : " + preSignedUrl.toString());
return GetPreSignedUrlRes.of(objectKey, preSignedUrl.toString());
return PreSignedUrlCreateOutDTO.of(objectKey, preSignedUrl.toString());

}

Expand Down