From afb1ca4732cf86722c0b9341e3aab59400b9d958 Mon Sep 17 00:00:00 2001 From: parkrootseok Date: Wed, 10 May 2023 16:14:07 +0900 Subject: [PATCH] =?UTF-8?q?[Chore]=20#268=20-=20PreSignedUrl=20DTO=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/cazait/domain/s3/api/S3ApiController.java | 4 ++-- .../PreSignedUrlCreateOutDTO.java} | 10 +++++----- .../java/shop/cazait/domain/s3/service/S3Service.java | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) rename src/main/java/shop/cazait/domain/s3/dto/{GetPreSignedUrlRes.java => response/PreSignedUrlCreateOutDTO.java} (59%) diff --git a/src/main/java/shop/cazait/domain/s3/api/S3ApiController.java b/src/main/java/shop/cazait/domain/s3/api/S3ApiController.java index 8846c33b..59dbc570 100644 --- a/src/main/java/shop/cazait/domain/s3/api/S3ApiController.java +++ b/src/main/java/shop/cazait/domain/s3/api/S3ApiController.java @@ -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; @@ -26,7 +26,7 @@ public class S3ApiController { @GetMapping("/pre-signed") @Operation(summary = "미리 서명된 주소 생성", description = "이미지 업로드를 위해 필요한 미리 서명된 주소를 받는다.") @Parameter(name = "directory", description = "이미지 종류", example = "cafe") - public SuccessResponse createPreSignedUrl(@RequestParam String directory) { + public SuccessResponse createPreSignedUrl(@RequestParam String directory) { return new SuccessResponse<>(SuccessStatus.SUCCESS, s3Service.createPreSignedUrl(directory)); } diff --git a/src/main/java/shop/cazait/domain/s3/dto/GetPreSignedUrlRes.java b/src/main/java/shop/cazait/domain/s3/dto/response/PreSignedUrlCreateOutDTO.java similarity index 59% rename from src/main/java/shop/cazait/domain/s3/dto/GetPreSignedUrlRes.java rename to src/main/java/shop/cazait/domain/s3/dto/response/PreSignedUrlCreateOutDTO.java index b3f8efd5..5866d70a 100644 --- a/src/main/java/shop/cazait/domain/s3/dto/GetPreSignedUrlRes.java +++ b/src/main/java/shop/cazait/domain/s3/dto/response/PreSignedUrlCreateOutDTO.java @@ -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(); diff --git a/src/main/java/shop/cazait/domain/s3/service/S3Service.java b/src/main/java/shop/cazait/domain/s3/service/S3Service.java index 143fc6c2..76541ca1 100644 --- a/src/main/java/shop/cazait/domain/s3/service/S3Service.java +++ b/src/main/java/shop/cazait/domain/s3/service/S3Service.java @@ -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 @@ -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); @@ -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()); }