From 5e6fc26ead41dc667217b3e3e70cdde9b3d6588d Mon Sep 17 00:00:00 2001 From: 70825 Date: Wed, 29 May 2024 22:00:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9C=A0=EC=A0=80=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EB=A9=94=EC=9D=B8=20DTO=EC=99=80=20=EA=BF=80=EC=A1=B0?= =?UTF-8?q?=ED=95=A9=EC=9C=BC=EB=A1=9C=20=EB=B3=B4=EC=9D=B4=EB=8A=94=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=A0=95=EB=B3=B4=20DTO=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../funeat/member/dto/MemberRecipeDto.java | 10 +++---- .../com/funeat/member/dto/MemberResponse.java | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/funeat/member/dto/MemberResponse.java 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; + } +}