Skip to content

Commit

Permalink
Merge pull request #244 from Genti2024/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
LeeJae-H authored Dec 11, 2024
2 parents f5f6388 + cb93b22 commit b93a64e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}

}

0 comments on commit b93a64e

Please sign in to comment.