Skip to content

Commit

Permalink
fix: 내 회원 정보 조회에서 닉네임, 프로필 이미지를 등록하지 않은 경우 NPE가 발생하는 오류 수정 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
scv1702 authored Jul 28, 2024
1 parent 2beda3d commit 5b35de5
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import es.princip.getp.domain.member.command.domain.model.Member;
import es.princip.getp.domain.member.command.domain.model.MemberType;
import es.princip.getp.domain.member.command.domain.model.Nickname;
import es.princip.getp.domain.member.command.domain.model.ProfileImage;

import java.time.LocalDateTime;
import java.util.Optional;

public record MemberResponse(
Long memberId,
Expand All @@ -18,8 +21,12 @@ public static MemberResponse from(final Member member) {
return new MemberResponse(
member.getMemberId(),
member.getEmail().getValue(),
member.getNickname().getValue(),
member.getProfileImage().getUri(),
Optional.ofNullable(member.getNickname())
.map(Nickname::getValue)
.orElse(null),
Optional.ofNullable(member.getProfileImage())
.map(ProfileImage::getUri)
.orElse(null),
member.getMemberType(),
member.getCreatedAt(),
member.getUpdatedAt()
Expand Down

0 comments on commit 5b35de5

Please sign in to comment.