-
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 #243 from Genti2024/fix/242-ios-feedview
Fix: #242 피드 뷰 예시 사진 조회 API의 ResponseDto 수정
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 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
47 changes: 47 additions & 0 deletions
47
...src/main/java/com/gt/genti/responseexample/dto/response/TempCommonPictureResponseDto.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,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(); | ||
} | ||
|
||
} |