diff --git a/cider-api/src/main/java/com/cmc/domains/certify/dto/response/CertifyResponseDto.java b/cider-api/src/main/java/com/cmc/domains/certify/dto/response/CertifyResponseDto.java index 7e9cc71..c430c2e 100644 --- a/cider-api/src/main/java/com/cmc/domains/certify/dto/response/CertifyResponseDto.java +++ b/cider-api/src/main/java/com/cmc/domains/certify/dto/response/CertifyResponseDto.java @@ -49,6 +49,11 @@ 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())) @@ -56,7 +61,7 @@ public static CertifyResponseDto from(Certify certify) { .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(); @@ -64,6 +69,11 @@ public static CertifyResponseDto from(Certify certify) { 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())) @@ -71,7 +81,7 @@ public static CertifyResponseDto from(Certify certify, Boolean isLike) { .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();