From 6fadf3318f83f42ab1da2b93d34b5b6667db58bc Mon Sep 17 00:00:00 2001 From: wellbeing-dough Date: Wed, 31 Jan 2024 17:52:42 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20:=20=EC=8A=A4=ED=84=B0=EB=94=94=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EB=8B=A8=EA=B1=B4=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EC=97=90=20isClose=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studyhubserver/studypost/dto/data/PostData.java | 4 +++- .../studypost/dto/response/FindPostResponseById.java | 2 ++ .../studypost/repository/StudyPostRepositoryImpl.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/PostData.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/PostData.java index 79eccdd2..ff0f6cea 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/PostData.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/PostData.java @@ -29,10 +29,11 @@ public class PostData { private final boolean isUsersPost; private final boolean isBookmarked; private final Long studyId; + private final boolean isClose; private final UserData postedUser; @Builder - public PostData(Long postId, String title, LocalDateTime createdDate, String content, MajorType major, int studyPerson, GenderType filteredGender, StudyWayType studyWay, int penalty, String penaltyWay, LocalDate studyStartDate, LocalDate studyEndDate, String charUrl, int remainingSeat, boolean isUsersPost, boolean isBookmarked, Long studyId, UserData postedUser) { + public PostData(Long postId, String title, LocalDateTime createdDate, String content, MajorType major, int studyPerson, GenderType filteredGender, StudyWayType studyWay, int penalty, String penaltyWay, LocalDate studyStartDate, LocalDate studyEndDate, String charUrl, int remainingSeat, boolean isUsersPost, boolean isBookmarked, Long studyId, boolean isClose, UserData postedUser) { this.postId = postId; this.title = title; this.createdDate = createdDate; @@ -50,6 +51,7 @@ public PostData(Long postId, String title, LocalDateTime createdDate, String con this.isUsersPost = isUsersPost; this.isBookmarked = isBookmarked; this.studyId = studyId; + this.isClose = isClose; this.postedUser = postedUser; } } diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/response/FindPostResponseById.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/response/FindPostResponseById.java index 990b2232..e85140cf 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/response/FindPostResponseById.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/response/FindPostResponseById.java @@ -31,6 +31,7 @@ public class FindPostResponseById { private final boolean isUsersPost; private final boolean isBookmarked; private final Long studyId; + private final boolean isClose; private final boolean isApply; private final UserData postedUser; private final List relatedPost; @@ -53,6 +54,7 @@ public FindPostResponseById(PostData postData, List relatedPost this.isUsersPost = postData.isUsersPost(); this.isBookmarked = postData.isBookmarked(); this.studyId = postData.getStudyId(); + this.isClose = postData.isClose(); this.postedUser = postData.getPostedUser(); this.relatedPost = relatedPosts; this.isApply = isApply; diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/repository/StudyPostRepositoryImpl.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/repository/StudyPostRepositoryImpl.java index b0c97a0a..504ea9a0 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/repository/StudyPostRepositoryImpl.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/repository/StudyPostRepositoryImpl.java @@ -117,7 +117,7 @@ public Optional findPostById(Long postId, Long userId) { post.studyStartDate, post.studyEndDate, post.chatUrl, post.remainingSeat, userId != null ? Expressions.booleanTemplate("{0} = {1}", post.postedUserId, userId) : Expressions.constant(false), userId != null ? Expressions.booleanTemplate("{0} = {1}", bookmark.userId, userId) : Expressions.constant(false), - post.studyId, + post.studyId, post.close.as("isClose"), Projections.constructor( UserData.class, user.id, user.major, user.nickname, user.imageUrl