From 785b09d34056238f61fc089bd2bb287df52a01c8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 24 Oct 2024 14:06:14 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=EC=8A=B9=EC=9D=B8=EB=90=9C=20?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=EC=9E=90=20=EC=88=98=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crew/main/global/dto/MeetingResponseDto.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java index 07022937..3545e690 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java @@ -70,9 +70,12 @@ public class MeetingResponseDto { @Schema(description = "모임장 정보", example = "") @NotNull private final MeetingCreatorDto user; - @Schema(description = "신청 승인 수", example = "7") + @Schema(description = "전체 신청자 수", example = "7") @NotNull private final int appliedCount; + @Schema(description = "승인된 신청자 수", example = "3") + @NotNull + private final int approvedCount; @QueryProjection public MeetingResponseDto(Integer id, String title, Integer targetActiveGeneration, @@ -80,7 +83,7 @@ public MeetingResponseDto(Integer id, String title, Integer targetActiveGenerati Integer status, List imageURL, Boolean isMentorNeeded, LocalDateTime mStartDate, LocalDateTime mEndDate, int capacity, - MeetingCreatorDto user, int appliedCount) { + MeetingCreatorDto user, int approvedCount) { boolean processedCanJoinOnlyActiveGeneration = canJoinOnlyActiveGeneration && (CrewConst.ACTIVE_GENERATION.equals(targetActiveGeneration)); @@ -98,7 +101,8 @@ public MeetingResponseDto(Integer id, String title, Integer targetActiveGenerati this.mEndDate = mEndDate; this.capacity = capacity; this.user = user; - this.appliedCount = appliedCount; + this.appliedCount = approvedCount; + this.approvedCount = approvedCount; } public LocalDateTime getmStartDate() { From d908f389a16976c85051f9f178a039d2040b7173 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 24 Oct 2024 14:18:07 +0900 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20QueryProjection=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20+=20=EB=AA=A8=EC=9E=84=20=EC=A0=9C=EB=AA=A9?= =?UTF-8?q?=EC=97=90=20private=20final=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/global/dto/MeetingResponseDto.java | 45 ++++--------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java index 3545e690..d8a676a7 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/global/dto/MeetingResponseDto.java @@ -3,16 +3,14 @@ import java.time.LocalDateTime; import java.util.List; +import java.util.Objects; import org.sopt.makers.crew.main.global.constant.CrewConst; import org.sopt.makers.crew.main.entity.meeting.Meeting; -import org.sopt.makers.crew.main.entity.meeting.enums.MeetingCategory; import org.sopt.makers.crew.main.entity.meeting.enums.MeetingJoinablePart; import org.sopt.makers.crew.main.entity.meeting.vo.ImageUrlVO; import org.sopt.makers.crew.main.entity.user.User; -import com.querydsl.core.annotations.QueryProjection; - import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.Getter; @@ -28,7 +26,7 @@ public class MeetingResponseDto { private final Integer id; @Schema(description = "모임 제목", example = "모임 제목입니다") @NotNull - String title; + private final String title; @Schema(description = "대상 기수", example = "33") @NotNull private final Integer targetActiveGeneration; @@ -70,41 +68,13 @@ public class MeetingResponseDto { @Schema(description = "모임장 정보", example = "") @NotNull private final MeetingCreatorDto user; - @Schema(description = "전체 신청자 수", example = "7") + @Schema(description = "TODO: FE에서 수정 완료 후 삭제 ", example = "[DEPRECATED]") @NotNull private final int appliedCount; @Schema(description = "승인된 신청자 수", example = "3") @NotNull private final int approvedCount; - @QueryProjection - public MeetingResponseDto(Integer id, String title, Integer targetActiveGeneration, - @NotNull MeetingJoinablePart[] joinableParts, MeetingCategory category, Boolean canJoinOnlyActiveGeneration, - Integer status, - List imageURL, Boolean isMentorNeeded, LocalDateTime mStartDate, LocalDateTime mEndDate, - int capacity, - MeetingCreatorDto user, int approvedCount) { - - boolean processedCanJoinOnlyActiveGeneration = canJoinOnlyActiveGeneration - && (CrewConst.ACTIVE_GENERATION.equals(targetActiveGeneration)); - - this.id = id; - this.title = title; - this.targetActiveGeneration = targetActiveGeneration; - this.joinableParts = joinableParts; - this.category = category.getValue(); - this.canJoinOnlyActiveGeneration = processedCanJoinOnlyActiveGeneration; - this.status = status; - this.imageURL = imageURL; - this.isMentorNeeded = isMentorNeeded; - this.mStartDate = mStartDate; - this.mEndDate = mEndDate; - this.capacity = capacity; - this.user = user; - this.appliedCount = approvedCount; - this.approvedCount = approvedCount; - } - public LocalDateTime getmStartDate() { return mStartDate; } @@ -113,15 +83,16 @@ public LocalDateTime getmEndDate() { return mEndDate; } - public static MeetingResponseDto of(Meeting meeting, User meetingCreator, int appliedCount, LocalDateTime now) { + public static MeetingResponseDto of(Meeting meeting, User meetingCreator, int approvedCount, LocalDateTime now) { MeetingCreatorDto creatorDto = MeetingCreatorDto.of(meetingCreator); - boolean canJoinOnlyActiveGeneration = meeting.getTargetActiveGeneration() == CrewConst.ACTIVE_GENERATION + boolean canJoinOnlyActiveGeneration = + Objects.equals(meeting.getTargetActiveGeneration(), CrewConst.ACTIVE_GENERATION) && meeting.getCanJoinOnlyActiveGeneration(); return new MeetingResponseDto(meeting.getId(), meeting.getTitle(), - meeting.getTargetActiveGeneration(), meeting.getJoinableParts(), meeting.getCategory(), + meeting.getTargetActiveGeneration(), meeting.getJoinableParts(), meeting.getCategory().getValue(), canJoinOnlyActiveGeneration, meeting.getMeetingStatus(now), meeting.getImageURL(), meeting.getIsMentorNeeded(), meeting.getMStartDate(), meeting.getMEndDate(), meeting.getCapacity(), - creatorDto, appliedCount); + creatorDto, approvedCount, approvedCount); } } From ac4f0a80cc2d840456606433e4439115b8d548be Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 24 Oct 2024 14:27:52 +0900 Subject: [PATCH 3/3] =?UTF-8?q?test:=20appliedCount=20->=20approvedCount?= =?UTF-8?q?=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crew/main/meeting/v2/service/MeetingV2ServiceTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/src/test/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceTest.java b/main/src/test/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceTest.java index 78ffd8a6..21b8a8ba 100644 --- a/main/src/test/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceTest.java +++ b/main/src/test/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceTest.java @@ -472,7 +472,7 @@ void normal_getMeetings_success() { "title", "category", "canJoinOnlyActiveGeneration", "mStartDate", "mEndDate", "capacity", "isMentorNeeded", "targetActiveGeneration", - "joinableParts", "status", "appliedCount" + "joinableParts", "status", "approvedCount" ).containsExactly( tuple("세미나 구합니다 - 신청후", "세미나", false, LocalDateTime.of(2024, 5, 29, 0, 0), @@ -542,7 +542,7 @@ void getOnlyActiveGenerationMeeting_getMeetings_meetings() { "title", "category", "canJoinOnlyActiveGeneration", "mStartDate", "mEndDate", "capacity", "isMentorNeeded", "targetActiveGeneration", - "joinableParts", "status", "appliedCount" + "joinableParts", "status", "approvedCount" ).containsExactly( tuple("스터디 구합니다1", "행사", true, LocalDateTime.of(2024, 5, 29, 0, 0), @@ -588,7 +588,7 @@ void getByCategory_getMeetings_meetings() { "title", "category", "canJoinOnlyActiveGeneration", "mStartDate", "mEndDate", "capacity", "isMentorNeeded", "targetActiveGeneration", - "joinableParts", "status", "appliedCount" + "joinableParts", "status", "approvedCount" ).containsExactly( tuple("세미나 구합니다 - 신청후", "세미나", false, LocalDateTime.of(2024, 5, 29, 0, 0),