From 9198c4ed1ff52514f42610927d05684bf8cc6b15 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Wed, 11 Dec 2024 17:07:39 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20#242=20=ED=94=BC=EB=93=9C=20=EB=B7=B0=20?= =?UTF-8?q?=EC=98=88=EC=8B=9C=20=EC=82=AC=EC=A7=84=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?API=EC=9D=98=20ResponseDto=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExampleWithPictureFindResponseDto.java | 4 +- .../TempCommonPictureResponseDto.java | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 genti-api/src/main/java/com/gt/genti/responseexample/dto/response/TempCommonPictureResponseDto.java diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java index 535c1ee8..55c77806 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java @@ -12,12 +12,12 @@ @NoArgsConstructor public class ExampleWithPictureFindResponseDto { @Schema(description = "예시 사진 응답") - CommonPictureResponseDto picture; + TempCommonPictureResponseDto picture; @Schema(description = "에시 프롬프트", example = "벚꽃길에서 벤치에 앉아있어요") String prompt; public ExampleWithPictureFindResponseDto(ResponseExample responseExample) { - this.picture = CommonPictureResponseDto.of(responseExample); + this.picture = TempCommonPictureResponseDto.of(responseExample); this.prompt = responseExample.getExamplePrompt(); } } diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/TempCommonPictureResponseDto.java b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/TempCommonPictureResponseDto.java new file mode 100644 index 00000000..cbda17f8 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/TempCommonPictureResponseDto.java @@ -0,0 +1,47 @@ +package com.gt.genti.responseexample.dto.response; + +import com.gt.genti.aws.AwsUtils; +import com.gt.genti.common.picture.model.PictureEntity; +import com.gt.genti.picture.PictureRatio; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@Schema(name = "[Picture][Anonymous] 임시 공통 사진 응답 dto") +public class TempCommonPictureResponseDto { + + @Schema(description = "해당 사진의 Entity id", example = "1") + Long id; + + @Schema(description = "해당 사진의 Url", example = "https://**") + String url; + + @Schema(description = "해당 사진의 Key값", example = "USER_UPLOADED_IMAGE/**") + String key; + + @Schema(description = "생성된 사진의 비율, 사진의 비율이 정해지지 않은 경우 \"NONE\"") + PictureRatio pictureRatio; + + @Builder + public TempCommonPictureResponseDto(Long id, String key, PictureRatio pictureRatio) { + this.id = id; + this.key = key; + this.url = AwsUtils.CLOUDFRONT_BASEURL + "/" + key; + this.pictureRatio = pictureRatio; + } + + public static TempCommonPictureResponseDto of(PictureEntity pictureEntity) { + if (pictureEntity == null) { + return null; + } + return TempCommonPictureResponseDto.builder() + .id(pictureEntity.getId()) + .key(pictureEntity.getKey()) + .pictureRatio(pictureEntity.getPictureRatio()) + .build(); + } + +}