From 3e24f7ffce590ac52d4d7556f03f89e07bd4d005 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 01:04:47 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[feat]=20=EC=9C=A0=EC=A0=80=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=B0=98=ED=99=98=20Dto=20=EC=B6=94=EA=B0=80=20(#4?= =?UTF-8?q?34)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/PlayGroundPostDetailResponse.java | 18 ++++++++++++++++++ .../home/response/RecentPostsResponse.java | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 src/main/java/org/sopt/app/application/playground/dto/PlayGroundPostDetailResponse.java diff --git a/src/main/java/org/sopt/app/application/playground/dto/PlayGroundPostDetailResponse.java b/src/main/java/org/sopt/app/application/playground/dto/PlayGroundPostDetailResponse.java new file mode 100644 index 00000000..94f48aec --- /dev/null +++ b/src/main/java/org/sopt/app/application/playground/dto/PlayGroundPostDetailResponse.java @@ -0,0 +1,18 @@ +package org.sopt.app.application.playground.dto; + +public record PlayGroundPostDetailResponse( + Member member, AnonymousProfile anonymousProfile +) { + public record Member( + String name, + String profileImage + ) { + } + + public record AnonymousProfile( + String nickname, + String profileImgUrl + ) { + } + +} \ No newline at end of file diff --git a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java index d6dbcf83..206af2c5 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java @@ -13,6 +13,8 @@ public class RecentPostsResponse { private Long id; private String title; + private String profileImage; + private String name; private String category; private String content; private boolean isHotPost; From c335893e8e8a58b46795a37a8a7a1121856ddb61 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 01:05:16 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[refactor]=20=EB=A1=9C=EC=A7=81=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/PlaygroundAuthService.java | 24 +++++++++++++++++++ .../playground/PlaygroundClient.java | 5 ++++ 2 files changed, 29 insertions(+) diff --git a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java index 57a124c8..4b85397c 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java @@ -19,6 +19,7 @@ import org.sopt.app.application.auth.dto.PlaygroundAuthTokenInfo.RefreshedToken; import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse; import org.sopt.app.application.playground.dto.PlayGroundPostCategory; +import org.sopt.app.application.playground.dto.PlayGroundPostDetailResponse; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPost; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.ActiveUserIds; @@ -199,6 +200,29 @@ public List getRecentPosts(String playgroundToken) { .join(); } } + + public List getRecentPostsWithMemberInfo(String playgroundToken) { + final Map accessToken = createAuthorizationHeaderByUserPlaygroundToken(playgroundToken); + List recentPosts = getRecentPosts(playgroundToken); + + for (RecentPostsResponse post : recentPosts) { + Long postId = post.getId(); + PlayGroundPostDetailResponse postDetail = playgroundClient.getPlayGroundPostDetail(accessToken, postId); + if (postDetail.member() != null) { + String profileImage = postDetail.member().profileImage(); + String name = postDetail.member().name(); + post.setProfileImage(profileImage); + post.setName(name); + } else if (postDetail.anonymousProfile() != null) { + String profileImage = postDetail.anonymousProfile().profileImgUrl(); + String name = postDetail.anonymousProfile().nickname(); + post.setProfileImage(profileImage); + post.setName(name); + } + + } + return recentPosts; + } public List getPlaygroundEmploymentPost(String accessToken) { Map requestHeader = createAuthorizationHeaderByUserPlaygroundToken(accessToken); diff --git a/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java b/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java index 66edf17c..4cfd98f5 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java @@ -8,6 +8,7 @@ import java.util.Map; import org.sopt.app.application.auth.dto.PlaygroundAuthTokenInfo.RefreshedToken; import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse; +import org.sopt.app.application.playground.dto.PlayGroundPostDetailResponse; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.ActiveUserIds; import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.OwnPlaygroundProfile; @@ -61,4 +62,8 @@ PlayGroundEmploymentResponse getPlaygroundEmploymentPost(@HeaderMap Map headers, + @Param Long postId); } From 28fff42e7ed9c04b64f71576c76f47bd84281ca0 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 01:05:32 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[del]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EB=B6=80=EB=B6=84=20=EC=A0=9C=EA=B1=B0=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/sopt/app/facade/HomeFacade.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/org/sopt/app/facade/HomeFacade.java b/src/main/java/org/sopt/app/facade/HomeFacade.java index 98e73310..4a9ab185 100755 --- a/src/main/java/org/sopt/app/facade/HomeFacade.java +++ b/src/main/java/org/sopt/app/facade/HomeFacade.java @@ -71,14 +71,7 @@ private boolean isServiceVisibleToUser(AppServiceInfo appServiceInfo, User user) } public List getRecentPosts(User user) { - return playgroundAuthService.getRecentPosts(user.getPlaygroundToken()).stream() - .map(post -> RecentPostsResponse.builder() - .id(post.getId()) - .title(post.getTitle()) - .category(post.getCategory()) - .isHotPost(post.isHotPost()) - .build() - ).toList(); + return playgroundAuthService.getRecentPostsWithMemberInfo(user.getPlaygroundToken()); } public List getHomeEmploymentPost(User user) { From 75c32fc1c739aa50f66e1486f92348997b6548e1 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 01:38:56 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[feat]=20Post=20=EC=83=81=EC=86=8D=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/dto/PostWithMemberInfo.java | 7 +++++++ .../home/response/EmploymentPostResponse.java | 15 ++++++++++++++- .../home/response/RecentPostsResponse.java | 19 ++++++++++++++++--- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java diff --git a/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java b/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java new file mode 100644 index 00000000..9d67e559 --- /dev/null +++ b/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java @@ -0,0 +1,7 @@ +package org.sopt.app.application.playground.dto; + +public interface PostWithMemberInfo { + void setProfileImage(String profileImage); + void setName(String name); + Long getId(); +} \ No newline at end of file diff --git a/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java b/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java index 5630b159..204248c4 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java @@ -4,12 +4,15 @@ import lombok.Builder; import lombok.Getter; import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse.EmploymentPost; +import org.sopt.app.application.playground.dto.PostWithMemberInfo; @Getter @Builder -public class EmploymentPostResponse { +public class EmploymentPostResponse implements PostWithMemberInfo { private final Long id; private final String categoryName; + private String profileImage; + private String name; private final String title; private final String content; private final List images; @@ -23,4 +26,14 @@ public static EmploymentPostResponse of(EmploymentPost employmentPost) { .images(employmentPost.images()) .build(); } + + @Override + public void setProfileImage(String profileImage) { + this.profileImage = profileImage; + } + + @Override + public void setName(String name) { + this.name = name; + } } \ No newline at end of file diff --git a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java index 206af2c5..2d549901 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java @@ -2,15 +2,18 @@ import lombok.AllArgsConstructor; import lombok.Builder; -import lombok.Data; +import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.Setter; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; +import org.sopt.app.application.playground.dto.PostWithMemberInfo; -@Data @Builder @NoArgsConstructor @AllArgsConstructor -public class RecentPostsResponse { +@Getter +public class RecentPostsResponse implements PostWithMemberInfo { + @Setter private Long id; private String title; private String profileImage; @@ -28,4 +31,14 @@ public static RecentPostsResponse of(PlaygroundPostResponse playgroundPostRespon .isHotPost(true) .build(); } + + @Override + public void setProfileImage(String profileImage) { + this.profileImage = profileImage; + } + + @Override + public void setName(String name) { + this.name = name; + } } \ No newline at end of file From 8b3c339fd1f3bb34bbc10a255b71d9707110c134 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 01:39:18 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[refactor]=20=EB=A9=94=EC=86=8C=EB=93=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/PlaygroundAuthService.java | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java index 4b85397c..60bca7b4 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java @@ -30,6 +30,7 @@ import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.PlaygroundMain; import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.PlaygroundProfile; import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.UserActiveInfo; +import org.sopt.app.application.playground.dto.PostWithMemberInfo; import org.sopt.app.common.exception.BadRequestException; import org.sopt.app.common.exception.UnauthorizedException; import org.sopt.app.common.response.ErrorCode; @@ -202,33 +203,39 @@ public List getRecentPosts(String playgroundToken) { } public List getRecentPostsWithMemberInfo(String playgroundToken) { - final Map accessToken = createAuthorizationHeaderByUserPlaygroundToken(playgroundToken); List recentPosts = getRecentPosts(playgroundToken); - - for (RecentPostsResponse post : recentPosts) { - Long postId = post.getId(); - PlayGroundPostDetailResponse postDetail = playgroundClient.getPlayGroundPostDetail(accessToken, postId); - if (postDetail.member() != null) { - String profileImage = postDetail.member().profileImage(); - String name = postDetail.member().name(); - post.setProfileImage(profileImage); - post.setName(name); - } else if (postDetail.anonymousProfile() != null) { - String profileImage = postDetail.anonymousProfile().profileImgUrl(); - String name = postDetail.anonymousProfile().nickname(); - post.setProfileImage(profileImage); - post.setName(name); - } - - } - return recentPosts; + return getPostsWithMemberInfo(playgroundToken, recentPosts); } public List getPlaygroundEmploymentPost(String accessToken) { Map requestHeader = createAuthorizationHeaderByUserPlaygroundToken(accessToken); PlayGroundEmploymentResponse postInfo = playgroundClient.getPlaygroundEmploymentPost(requestHeader,16,10,0); return postInfo.posts().stream() - .map(EmploymentPostResponse::of) - .collect(Collectors.toList()); + .map(EmploymentPostResponse::of).toList(); + } + + public List getPlaygroundEmploymentPostWithMemberInfo(String playgroundToken) { + List employmentPosts = getPlaygroundEmploymentPost(playgroundToken); + return getPostsWithMemberInfo(playgroundToken, employmentPosts); + } + + private void addMemberInfoToPost(T post, PlayGroundPostDetailResponse postDetail) { + if (postDetail.member() != null) { + post.setProfileImage(postDetail.member().profileImage()); + post.setName(postDetail.member().name()); + } else if (postDetail.anonymousProfile() != null) { + post.setProfileImage(postDetail.anonymousProfile().profileImgUrl()); + post.setName(postDetail.anonymousProfile().nickname()); + } + } + + private List getPostsWithMemberInfo(String playgroundToken, List posts) { + final Map accessToken = createAuthorizationHeaderByUserPlaygroundToken(playgroundToken); + for (T post : posts) { + Long postId = post.getId(); + PlayGroundPostDetailResponse postDetail = playgroundClient.getPlayGroundPostDetail(accessToken, postId); + addMemberInfoToPost(post, postDetail); + } + return posts; } } From 3de6384c154342a49cb22fe1e16217607bed6fa7 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 01:39:38 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[refactor]=20=EA=B8=B0=EB=8A=A5=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/sopt/app/facade/HomeFacade.java | 2 +- .../java/org/sopt/app/presentation/home/HomeController.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sopt/app/facade/HomeFacade.java b/src/main/java/org/sopt/app/facade/HomeFacade.java index 4a9ab185..5b6484d9 100755 --- a/src/main/java/org/sopt/app/facade/HomeFacade.java +++ b/src/main/java/org/sopt/app/facade/HomeFacade.java @@ -75,7 +75,7 @@ public List getRecentPosts(User user) { } public List getHomeEmploymentPost(User user) { - return playgroundAuthService.getPlaygroundEmploymentPost(user.getPlaygroundToken()); + return playgroundAuthService.getPlaygroundEmploymentPostWithMemberInfo(user.getPlaygroundToken()); } } diff --git a/src/main/java/org/sopt/app/presentation/home/HomeController.java b/src/main/java/org/sopt/app/presentation/home/HomeController.java index 21159809..8729ba33 100644 --- a/src/main/java/org/sopt/app/presentation/home/HomeController.java +++ b/src/main/java/org/sopt/app/presentation/home/HomeController.java @@ -56,7 +56,7 @@ public ResponseEntity> getAppService( } - @Operation(summary = "최근 채용탭 10개 조회") + @Operation(summary = "최근 게시물 카테고리별 조회") @ApiResponses({ @ApiResponse(responseCode = "200", description = "success"), @ApiResponse(responseCode = "401", description = "token error", content = @Content), @@ -70,6 +70,7 @@ public ResponseEntity> getRecentPost( homeFacade.getRecentPosts(user)); } + @Operation(summary = "최근 채용탭 10개 조회") @ApiResponses({ @ApiResponse(responseCode = "200", description = "success"), @ApiResponse(responseCode = "401", description = "token error", content = @Content), From 9660f7b2d8edeff4d7429f1e1994d9c3b27b9278 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 15:03:16 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[fix]=20boolean=20->=20Boolean=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/presentation/home/response/RecentPostsResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java index 2d549901..871a82ad 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java @@ -20,7 +20,7 @@ public class RecentPostsResponse implements PostWithMemberInfo { private String name; private String category; private String content; - private boolean isHotPost; + private Boolean isHotPost; public static RecentPostsResponse of(PlaygroundPostResponse playgroundPostResponse) { return RecentPostsResponse.builder() From e15328bb7ddc13c3b466ace2d72e71fb83e5046c Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Tue, 19 Nov 2024 16:03:09 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[refactor]=20=EB=B6=88=EB=B3=80=EC=84=B1=20?= =?UTF-8?q?=EB=B3=B4=EC=9E=A5=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#4?= =?UTF-8?q?34)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/PlaygroundAuthService.java | 15 +++++---- .../playground/dto/PostWithMemberInfo.java | 3 +- .../home/response/EmploymentPostResponse.java | 32 +++++++++++-------- .../home/response/RecentPostsResponse.java | 24 +++++++------- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java index 60bca7b4..0b5e8c3f 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java @@ -4,6 +4,7 @@ import static org.sopt.app.application.playground.PlaygroundHeaderCreator.createDefaultHeader; import io.jsonwebtoken.ExpiredJwtException; +import jakarta.persistence.EntityNotFoundException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -219,23 +220,23 @@ public List getPlaygroundEmploymentPostWithMemberInfo(St return getPostsWithMemberInfo(playgroundToken, employmentPosts); } - private void addMemberInfoToPost(T post, PlayGroundPostDetailResponse postDetail) { + private T addMemberInfoToPost(T post, PlayGroundPostDetailResponse postDetail) { if (postDetail.member() != null) { - post.setProfileImage(postDetail.member().profileImage()); - post.setName(postDetail.member().name()); + return (T) post.withMemberDetail(postDetail.member().name(), postDetail.member().profileImage()); } else if (postDetail.anonymousProfile() != null) { - post.setProfileImage(postDetail.anonymousProfile().profileImgUrl()); - post.setName(postDetail.anonymousProfile().nickname()); + return (T) post.withMemberDetail(postDetail.anonymousProfile().nickname(), postDetail.anonymousProfile().profileImgUrl()); } + throw new EntityNotFoundException("Member not found"); } private List getPostsWithMemberInfo(String playgroundToken, List posts) { final Map accessToken = createAuthorizationHeaderByUserPlaygroundToken(playgroundToken); + List mutablePosts = new ArrayList<>(); for (T post : posts) { Long postId = post.getId(); PlayGroundPostDetailResponse postDetail = playgroundClient.getPlayGroundPostDetail(accessToken, postId); - addMemberInfoToPost(post, postDetail); + mutablePosts.add(addMemberInfoToPost(post, postDetail)); } - return posts; + return mutablePosts; } } diff --git a/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java b/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java index 9d67e559..c55859c0 100644 --- a/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java +++ b/src/main/java/org/sopt/app/application/playground/dto/PostWithMemberInfo.java @@ -1,7 +1,6 @@ package org.sopt.app.application.playground.dto; public interface PostWithMemberInfo { - void setProfileImage(String profileImage); - void setName(String name); + Object withMemberDetail(String name, String profileImage); Long getId(); } \ No newline at end of file diff --git a/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java b/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java index 204248c4..6f1c01e0 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/EmploymentPostResponse.java @@ -1,21 +1,25 @@ package org.sopt.app.presentation.home.response; import java.util.List; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; +import lombok.NoArgsConstructor; import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse.EmploymentPost; import org.sopt.app.application.playground.dto.PostWithMemberInfo; @Getter @Builder +@AllArgsConstructor +@NoArgsConstructor public class EmploymentPostResponse implements PostWithMemberInfo { - private final Long id; - private final String categoryName; + private Long id; + private String categoryName; private String profileImage; private String name; - private final String title; - private final String content; - private final List images; + private String title; + private String content; + private List images; public static EmploymentPostResponse of(EmploymentPost employmentPost) { return EmploymentPostResponse.builder() @@ -27,13 +31,15 @@ public static EmploymentPostResponse of(EmploymentPost employmentPost) { .build(); } - @Override - public void setProfileImage(String profileImage) { - this.profileImage = profileImage; - } - - @Override - public void setName(String name) { - this.name = name; + public EmploymentPostResponse withMemberDetail(String name, String profileImage) { + return EmploymentPostResponse.builder() + .id(this.id) + .categoryName(this.categoryName) + .name(name) + .profileImage(profileImage) + .title(this.title) + .content(this.content) + .images(this.images) + .build(); } } \ No newline at end of file diff --git a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java index 871a82ad..207f85f3 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/RecentPostsResponse.java @@ -4,16 +4,14 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.Setter; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; import org.sopt.app.application.playground.dto.PostWithMemberInfo; @Builder -@NoArgsConstructor @AllArgsConstructor @Getter +@NoArgsConstructor public class RecentPostsResponse implements PostWithMemberInfo { - @Setter private Long id; private String title; private String profileImage; @@ -21,7 +19,8 @@ public class RecentPostsResponse implements PostWithMemberInfo { private String category; private String content; private Boolean isHotPost; - + + public static RecentPostsResponse of(PlaygroundPostResponse playgroundPostResponse) { return RecentPostsResponse.builder() .id(playgroundPostResponse.postId()) @@ -32,13 +31,16 @@ public static RecentPostsResponse of(PlaygroundPostResponse playgroundPostRespon .build(); } - @Override - public void setProfileImage(String profileImage) { - this.profileImage = profileImage; + public RecentPostsResponse withMemberDetail(String name, String profileImage) { + return RecentPostsResponse.builder() + .id(this.id) + .title(this.title) + .profileImage(profileImage) + .name(name) + .category(this.category) + .content(this.content) + .isHotPost(this.isHotPost) + .build(); } - @Override - public void setName(String name) { - this.name = name; - } } \ No newline at end of file