diff --git a/src/main/java/com/funeat/member/dto/MemberRecipeDto.java b/src/main/java/com/funeat/member/dto/MemberRecipeDto.java index 5a21e09a..cd7cce42 100644 --- a/src/main/java/com/funeat/member/dto/MemberRecipeDto.java +++ b/src/main/java/com/funeat/member/dto/MemberRecipeDto.java @@ -11,17 +11,17 @@ public class MemberRecipeDto { private final Long id; private final String title; private final String content; - private final MemberProfileResponse author; + private final MemberResponse author; private final LocalDateTime createdAt; private final String image; - private MemberRecipeDto(final Long id, final String title, final String content, final MemberProfileResponse author, + private MemberRecipeDto(final Long id, final String title, final String content, final MemberResponse author, final LocalDateTime createdAt) { this(id, title, content, author, createdAt, null); } @JsonCreator - private MemberRecipeDto(final Long id, final String title, final String content, final MemberProfileResponse author, + private MemberRecipeDto(final Long id, final String title, final String content, final MemberResponse author, final LocalDateTime createdAt, final String image) { this.id = id; this.title = title; @@ -32,7 +32,7 @@ private MemberRecipeDto(final Long id, final String title, final String content, } public static MemberRecipeDto toDto(final Recipe recipe, final List findRecipeImages) { - final MemberProfileResponse author = MemberProfileResponse.toResponse(recipe.getMember()); + final MemberResponse author = MemberResponse.toResponse(recipe.getMember()); if (findRecipeImages.isEmpty()) { return new MemberRecipeDto(recipe.getId(), recipe.getTitle(), recipe.getContent(),author, @@ -54,7 +54,7 @@ public String getContent() { return content; } - public MemberProfileResponse getAuthor() { + public MemberResponse getAuthor() { return author; } diff --git a/src/main/java/com/funeat/member/dto/MemberResponse.java b/src/main/java/com/funeat/member/dto/MemberResponse.java new file mode 100644 index 00000000..70703038 --- /dev/null +++ b/src/main/java/com/funeat/member/dto/MemberResponse.java @@ -0,0 +1,26 @@ +package com.funeat.member.dto; + +import com.funeat.member.domain.Member; + +public class MemberResponse { + + private final String nickname; + private final String profileImage; + + public MemberResponse(final String nickname, final String profileImage) { + this.nickname = nickname; + this.profileImage = profileImage; + } + + public static MemberResponse toResponse(final Member member) { + return new MemberResponse(member.getNickname(), member.getProfileImage()); + } + + public String getNickname() { + return nickname; + } + + public String getProfileImage() { + return profileImage; + } +}