Skip to content

Commit

Permalink
fix: 추천 피드 조회 api - image null 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
daeunkwak committed Sep 9, 2023
1 parent 7e58f1e commit 88de86d
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,39 @@ public class CertifyResponseDto {

public static CertifyResponseDto from(Certify certify) {

String url = "";
if(certify.getCertifyImageList().size() != 0){
url = certify.getCertifyImageList().get(0).getImageUrl();
}

return CertifyResponseDto.builder()
.simpleMemberResponseDto(SimpleMemberResponseDto.from(certify.getParticipate().getMember()))
.simpleChallengeResponseDto(SimpleChallengeResponseDto.from(certify.getParticipate().getChallenge()))
.createdDate(certify.getCreatedDate())
.certifyId(certify.getCertifyId())
.certifyName(certify.getCertifyName())
.certifyContent(certify.getCertifyContent())
.certifyImageUrl(certify.getCertifyImageList().get(0).getImageUrl())
.certifyImageUrl(url)
.certifyLike((long) certify.getCertifyLikeList().size())
.isLike(false)
.build();
}

public static CertifyResponseDto from(Certify certify, Boolean isLike) {

String url = "";
if(certify.getCertifyImageList().size() != 0){
url = certify.getCertifyImageList().get(0).getImageUrl();
}

return CertifyResponseDto.builder()
.simpleMemberResponseDto(SimpleMemberResponseDto.from(certify.getParticipate().getMember()))
.simpleChallengeResponseDto(SimpleChallengeResponseDto.from(certify.getParticipate().getChallenge()))
.createdDate(certify.getCreatedDate())
.certifyId(certify.getCertifyId())
.certifyName(certify.getCertifyName())
.certifyContent(certify.getCertifyContent())
.certifyImageUrl(certify.getCertifyImageList().get(0).getImageUrl())
.certifyImageUrl(url)
.certifyLike((long) certify.getCertifyLikeList().size())
.isLike(isLike)
.build();
Expand Down

0 comments on commit 88de86d

Please sign in to comment.