From 5b6b579d610e084f6c0a9f958343aaa8ff055c80 Mon Sep 17 00:00:00 2001 From: elyudwo Date: Sun, 28 Jan 2024 15:35:52 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Fix]=20:=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1,=20=EC=88=98=EC=A0=95=20=EC=8B=9C=20close=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=EA=B0=80=20=EB=B0=98=EC=98=81=EB=90=98?= =?UTF-8?q?=EC=A7=80=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studypost/domain/StudyPostEntity.java | 4 ++- .../dto/data/UpdateStudyPostInfo.java | 30 +++++++++-------- .../dto/request/CreatePostRequest.java | 33 ++++++++++--------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/StudyPostEntity.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/StudyPostEntity.java index c7014f48..94257dca 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/StudyPostEntity.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/domain/StudyPostEntity.java @@ -70,7 +70,7 @@ public class StudyPostEntity extends BaseTimeEntity { private Long studyId; @Builder - public StudyPostEntity(Long id, String title, String content, String chatUrl, MajorType major, int studyPerson, GenderType filteredGender, StudyWayType studyWay, int penalty, String penaltyWay, LocalDate studyStartDate, LocalDate studyEndDate, Long postedUserId, int remainingSeat, Long studyId) { + public StudyPostEntity(Long id, String title, String content, String chatUrl, MajorType major, int studyPerson, GenderType filteredGender, StudyWayType studyWay, int penalty, String penaltyWay, boolean close, LocalDate studyStartDate, LocalDate studyEndDate, Long postedUserId, int remainingSeat, Long studyId) { this.id = id; this.title = title; this.content = content; @@ -81,6 +81,7 @@ public StudyPostEntity(Long id, String title, String content, String chatUrl, Ma this.studyWay = studyWay; this.penalty = penalty; this.penaltyWay = penaltyWay; + this.close = close; this.studyStartDate = studyStartDate; this.studyEndDate = studyEndDate; this.postedUserId = postedUserId; @@ -98,6 +99,7 @@ public void update(UpdateStudyPostInfo info) { this.studyWay = info.getStudyWay(); this.penalty = info.getPenalty(); this.penaltyWay = info.getPenaltyWay(); + this.close = info.isClose(); this.studyStartDate = info.getStudyStartDate(); this.studyEndDate = info.getStudyEndDate(); } diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/UpdateStudyPostInfo.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/UpdateStudyPostInfo.java index 2a4d9574..8cf6b3c5 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/UpdateStudyPostInfo.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/data/UpdateStudyPostInfo.java @@ -10,22 +10,23 @@ @Getter public class UpdateStudyPostInfo { - private Long postId; - private Long userId; - private String title; - private String content; - private String chatUrl; - private MajorType major; - private int studyPerson; - private int penalty; - private String penaltyWay; - private GenderType gender; - private StudyWayType studyWay; - private LocalDate studyStartDate; - private LocalDate studyEndDate; + private final Long postId; + private final Long userId; + private final String title; + private final String content; + private final String chatUrl; + private final MajorType major; + private final int studyPerson; + private final int penalty; + private final String penaltyWay; + private final boolean close; + private final GenderType gender; + private final StudyWayType studyWay; + private final LocalDate studyStartDate; + private final LocalDate studyEndDate; @Builder - public UpdateStudyPostInfo(Long postId, Long userId, String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) { + public UpdateStudyPostInfo(Long postId, Long userId, String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, boolean close, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) { this.postId = postId; this.userId = userId; this.title = title; @@ -35,6 +36,7 @@ public UpdateStudyPostInfo(Long postId, Long userId, String title, String conten this.studyPerson = studyPerson; this.penalty = penalty; this.penaltyWay = penaltyWay; + this.close = close; this.gender = gender; this.studyWay = studyWay; this.studyStartDate = studyStartDate; diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/request/CreatePostRequest.java b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/request/CreatePostRequest.java index 00b119a0..ed658641 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/request/CreatePostRequest.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/studypost/dto/request/CreatePostRequest.java @@ -73,22 +73,6 @@ public class CreatePostRequest { @NotNull(message = "스터디 종료 날짜 작성은 필수입니다!") private LocalDate studyEndDate; - @Builder - public CreatePostRequest(String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, boolean close, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) { - this.title = title; - this.content = content; - this.chatUrl = chatUrl; - this.major = major; - this.studyPerson = studyPerson; - this.penalty = penalty; - this.penaltyWay = penaltyWay; - this.close = close; - this.gender = gender; - this.studyWay = studyWay; - this.studyStartDate = studyStartDate; - this.studyEndDate = studyEndDate; - } - public StudyEntity toStudyEntity(Long userId) { return StudyEntity.builder() .title(title) @@ -112,6 +96,7 @@ public StudyPostEntity toStudyPostEntity(Long userId, Long studyId) { .studyWay(studyWay) .penalty(penalty) .penaltyWay(penaltyWay) + .close(close) .studyStartDate(studyStartDate) .studyEndDate(studyEndDate) .postedUserId(userId) @@ -119,4 +104,20 @@ public StudyPostEntity toStudyPostEntity(Long userId, Long studyId) { .studyId(studyId) .build(); } + + @Builder + public CreatePostRequest(String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, boolean close, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) { + this.title = title; + this.content = content; + this.chatUrl = chatUrl; + this.major = major; + this.studyPerson = studyPerson; + this.penalty = penalty; + this.penaltyWay = penaltyWay; + this.close = close; + this.gender = gender; + this.studyWay = studyWay; + this.studyStartDate = studyStartDate; + this.studyEndDate = studyEndDate; + } } From af1d39e8070e0d34ad6251f0bb233f9bd63586f7 Mon Sep 17 00:00:00 2001 From: elyudwo Date: Sun, 28 Jan 2024 15:36:29 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Refactor]=20:=20=EB=82=B4=EA=B0=80=20?= =?UTF-8?q?=EC=93=B4=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=8B=9C=20=EB=A7=88=EA=B0=90=EB=90=9C=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=20=ED=9B=84=20=EC=88=9C=EC=9C=84=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studypost/repository/StudyPostRepositoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 47ad617a..b0c97a0a 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 @@ -95,7 +95,7 @@ public List findByPostedUserId(final Long userId, final Pageab ) .from(post) .where(post.postedUserId.eq(userId)) - .orderBy(post.createdDate.desc()) + .orderBy(post.close.asc(), post.createdDate.desc()) .offset(pageable.getOffset()) .limit(pageable.getPageSize() + 1);