From 821cba7fee6d0cef7cd234ebc12a7323b2156331 Mon Sep 17 00:00:00 2001 From: sso0om Date: Mon, 13 Oct 2025 11:40:39 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Refactor:=20=EC=9D=91=EB=8B=B5=EC=97=90=20m?= =?UTF-8?q?emberId=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/back/domain/member/mentee/dto/MenteeDto.java | 3 +++ .../domain/member/mentor/dto/MentorDetailDto.java | 3 +++ .../com/back/domain/member/mentor/dto/MentorDto.java | 3 +++ .../mentoring/dto/MentoringWithTagsDto.java | 3 +++ .../mentoring/dto/response/ReviewResponse.java | 3 +++ .../mentoring/slot/dto/response/MentorSlotDto.java | 2 ++ .../slot/repository/MentorSlotRepository.java | 2 ++ .../slot/service/MentorSlotServiceTest.java | 12 +++++++----- 8 files changed, 26 insertions(+), 5 deletions(-) diff --git a/back/src/main/java/com/back/domain/member/mentee/dto/MenteeDto.java b/back/src/main/java/com/back/domain/member/mentee/dto/MenteeDto.java index a6f837bd..76988b20 100644 --- a/back/src/main/java/com/back/domain/member/mentee/dto/MenteeDto.java +++ b/back/src/main/java/com/back/domain/member/mentee/dto/MenteeDto.java @@ -6,12 +6,15 @@ public record MenteeDto( @Schema(description = "멘티 ID") Long menteeId, + @Schema(description = "멘티 회원 ID") + Long menteeMemberId, @Schema(description = "멘티 닉네임") String nickname ) { public static MenteeDto from(Mentee mentee) { return new MenteeDto( mentee.getId(), + mentee.getMember().getId(), mentee.getMember().getNickname() ); } diff --git a/back/src/main/java/com/back/domain/member/mentor/dto/MentorDetailDto.java b/back/src/main/java/com/back/domain/member/mentor/dto/MentorDetailDto.java index 4c4e27c0..e0639fae 100644 --- a/back/src/main/java/com/back/domain/member/mentor/dto/MentorDetailDto.java +++ b/back/src/main/java/com/back/domain/member/mentor/dto/MentorDetailDto.java @@ -6,6 +6,8 @@ public record MentorDetailDto( @Schema(description = "멘토 ID") Long mentorId, + @Schema(description = "멘토 회원 ID") + Long mentorMemberId, @Schema(description = "멘토 닉네임") String nickname, @Schema(description = "평점") @@ -17,6 +19,7 @@ public record MentorDetailDto( public static MentorDetailDto from(Mentor mentor) { return new MentorDetailDto( mentor.getId(), + mentor.getMember().getId(), mentor.getMember().getNickname(), mentor.getRate(), mentor.getCareerYears() diff --git a/back/src/main/java/com/back/domain/member/mentor/dto/MentorDto.java b/back/src/main/java/com/back/domain/member/mentor/dto/MentorDto.java index d25fb2ec..88a6063b 100644 --- a/back/src/main/java/com/back/domain/member/mentor/dto/MentorDto.java +++ b/back/src/main/java/com/back/domain/member/mentor/dto/MentorDto.java @@ -6,12 +6,15 @@ public record MentorDto( @Schema(description = "멘토 ID") Long mentorId, + @Schema(description = "멘토 회원 ID") + Long mentorMemberId, @Schema(description = "멘토 닉네임") String nickname ) { public static MentorDto from(Mentor mentor) { return new MentorDto( mentor.getId(), + mentor.getMember().getId(), mentor.getMember().getNickname() ); } diff --git a/back/src/main/java/com/back/domain/mentoring/mentoring/dto/MentoringWithTagsDto.java b/back/src/main/java/com/back/domain/mentoring/mentoring/dto/MentoringWithTagsDto.java index 1331f751..67e2f730 100644 --- a/back/src/main/java/com/back/domain/mentoring/mentoring/dto/MentoringWithTagsDto.java +++ b/back/src/main/java/com/back/domain/mentoring/mentoring/dto/MentoringWithTagsDto.java @@ -14,6 +14,8 @@ public record MentoringWithTagsDto( List tags, @Schema(description = "멘토 ID") Long mentorId, + @Schema(description = "멘토 회원 ID") + Long mentorMemberId, @Schema(description = "멘토 닉네임") String nickname ) { @@ -23,6 +25,7 @@ public static MentoringWithTagsDto from(Mentoring mentoring) { mentoring.getTitle(), mentoring.getTagNames(), mentoring.getMentor().getId(), + mentoring.getMentor().getMember().getId(), mentoring.getMentor().getMember().getNickname() ); } diff --git a/back/src/main/java/com/back/domain/mentoring/mentoring/dto/response/ReviewResponse.java b/back/src/main/java/com/back/domain/mentoring/mentoring/dto/response/ReviewResponse.java index 99291a55..c80f7e89 100644 --- a/back/src/main/java/com/back/domain/mentoring/mentoring/dto/response/ReviewResponse.java +++ b/back/src/main/java/com/back/domain/mentoring/mentoring/dto/response/ReviewResponse.java @@ -19,6 +19,8 @@ public record ReviewResponse( @Schema(description = "멘티 ID") Long menteeId, + @Schema(description = "멘티 회원 ID") + Long menteeMemberId, @Schema(description = "멘티 닉네임") String menteeNickname ) { @@ -30,6 +32,7 @@ public static ReviewResponse from(Review review) { review.getCreateDate(), review.getModifyDate(), review.getMentee().getId(), + review.getMentee().getMember().getId(), review.getMentee().getMember().getNickname() ); } diff --git a/back/src/main/java/com/back/domain/mentoring/slot/dto/response/MentorSlotDto.java b/back/src/main/java/com/back/domain/mentoring/slot/dto/response/MentorSlotDto.java index 2185b0ec..6644a768 100644 --- a/back/src/main/java/com/back/domain/mentoring/slot/dto/response/MentorSlotDto.java +++ b/back/src/main/java/com/back/domain/mentoring/slot/dto/response/MentorSlotDto.java @@ -10,6 +10,8 @@ public record MentorSlotDto( Long mentorSlotId, @Schema(description = "멘토 ID") Long mentorId, + @Schema(description = "멘토 회원 ID") + Long mentorMemberId, @Schema(description = "시작 일시") LocalDateTime startDateTime, @Schema(description = "종료 일시") diff --git a/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java b/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java index f97856e6..dbcd1735 100644 --- a/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java +++ b/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java @@ -21,6 +21,7 @@ public interface MentorSlotRepository extends JpaRepository { SELECT new com.back.domain.mentoring.slot.dto.response.MentorSlotDto( ms.id, ms.mentor.id, + ms.mentor.member.id, ms.startDateTime, ms.endDateTime, ms.status, @@ -45,6 +46,7 @@ List findMySlots( SELECT new com.back.domain.mentoring.slot.dto.response.MentorSlotDto( ms.id, ms.mentor.id, + ms.mentor.member.id, ms.startDateTime, ms.endDateTime, ms.status, diff --git a/back/src/test/java/com/back/domain/mentoring/slot/service/MentorSlotServiceTest.java b/back/src/test/java/com/back/domain/mentoring/slot/service/MentorSlotServiceTest.java index 7995d3cc..7c3870e9 100644 --- a/back/src/test/java/com/back/domain/mentoring/slot/service/MentorSlotServiceTest.java +++ b/back/src/test/java/com/back/domain/mentoring/slot/service/MentorSlotServiceTest.java @@ -88,23 +88,24 @@ void getMyMentorSlots() { LocalDate base = LocalDate.now().plusMonths(1); LocalDateTime startDate = base.atStartOfDay(); LocalDateTime endDate = base.withDayOfMonth(base.lengthOfMonth()).atTime(23, 59); + Long memberId = mentor1.getMember().getId(); MentorSlotDto slotDto1 = new MentorSlotDto( - 1L, mentor1.getId(), + 1L, mentor1.getId(), memberId, mentorSlot1.getStartDateTime(), mentorSlot1.getEndDateTime(), MentorSlotStatus.AVAILABLE, null ); MentorSlotDto slotDto2 = new MentorSlotDto( - 2L, mentor1.getId(), + 2L, mentor1.getId(), memberId, base.withDayOfMonth(2).atTime(10, 0), base.withDayOfMonth(2).atTime(11, 0), MentorSlotStatus.AVAILABLE, null ); MentorSlotDto slotDto3 = new MentorSlotDto( - 3L, mentor1.getId(), + 3L, mentor1.getId(), memberId, base.withDayOfMonth(15).atTime(14, 0), base.withDayOfMonth(15).atTime(15, 0), MentorSlotStatus.AVAILABLE, @@ -155,16 +156,17 @@ void getAvailableMentorSlots() { LocalDate base = LocalDate.now().plusMonths(1); LocalDateTime startDate = base.atStartOfDay(); LocalDateTime endDate = base.withDayOfMonth(base.lengthOfMonth()).atTime(23, 59); + Long memberId = mentor1.getMember().getId(); MentorSlotDto slotDto1 = new MentorSlotDto( - 1L, mentor1.getId(), + 1L, mentor1.getId(), memberId, mentorSlot1.getStartDateTime(), mentorSlot1.getEndDateTime(), MentorSlotStatus.AVAILABLE, null ); MentorSlotDto slotDto2 = new MentorSlotDto( - 2L, mentor1.getId(), + 2L, mentor1.getId(), memberId, base.withDayOfMonth(2).atTime(10, 0), base.withDayOfMonth(2).atTime(11, 0), MentorSlotStatus.AVAILABLE, From 6e06a4266c5684e9f8a97bfdcfac0baafff41949 Mon Sep 17 00:00:00 2001 From: sso0om Date: Mon, 13 Oct 2025 12:47:07 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Refactor:=20=EB=A9=98=ED=8B=B0=EB=8A=94=20?= =?UTF-8?q?=ED=98=84=EC=9E=AC=EC=9D=BC=20=EC=9D=B4=ED=9B=84=20=EC=8A=AC?= =?UTF-8?q?=EB=A1=AF=EB=A7=8C=20=EC=A1=B0=ED=9A=8C=20=EA=B0=80=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/mentoring/slot/repository/MentorSlotRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java b/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java index dbcd1735..0f4dcc79 100644 --- a/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java +++ b/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java @@ -55,6 +55,7 @@ List findMySlots( FROM MentorSlot ms WHERE ms.mentor.id = :mentorId AND ms.status = 'AVAILABLE' + AND ms.startDateTime >= CURRENT_TIMESTAMP AND ms.startDateTime < :end AND ms.endDateTime >= :start ORDER BY ms.startDateTime ASC From e3b464f907c9af0862ee1d7d6a5552891fad4646 Mon Sep 17 00:00:00 2001 From: sso0om Date: Mon, 13 Oct 2025 14:19:22 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Refactor:=20=EB=82=98=EC=9D=98=20=EC=8A=AC?= =?UTF-8?q?=EB=A1=AF=EC=9D=80=20=ED=98=84=EC=9E=AC=EC=9D=BC=20=EC=9D=B4?= =?UTF-8?q?=EC=A0=84=EC=9D=B4=EA=B3=A0=20=EC=98=88=EC=95=BD=20=EC=9D=B4?= =?UTF-8?q?=EB=A0=A5=EC=9D=B4=20=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?expired=20=EB=A1=9C=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/mentoring/slot/constant/MentorSlotStatus.java | 3 ++- .../mentoring/slot/repository/MentorSlotRepository.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/back/src/main/java/com/back/domain/mentoring/slot/constant/MentorSlotStatus.java b/back/src/main/java/com/back/domain/mentoring/slot/constant/MentorSlotStatus.java index 13d16388..a13e097b 100644 --- a/back/src/main/java/com/back/domain/mentoring/slot/constant/MentorSlotStatus.java +++ b/back/src/main/java/com/back/domain/mentoring/slot/constant/MentorSlotStatus.java @@ -4,5 +4,6 @@ public enum MentorSlotStatus { AVAILABLE, // 예약 가능 PENDING, // 예약 승인 대기 APPROVED, // 예약 승인됨(확정) - COMPLETED // 멘토링 완료 + COMPLETED, // 멘토링 완료 + EXPIRED // 만료 } diff --git a/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java b/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java index 0f4dcc79..82c73db5 100644 --- a/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java +++ b/back/src/main/java/com/back/domain/mentoring/slot/repository/MentorSlotRepository.java @@ -24,7 +24,12 @@ public interface MentorSlotRepository extends JpaRepository { ms.mentor.member.id, ms.startDateTime, ms.endDateTime, - ms.status, + CASE + WHEN ms.startDateTime < CURRENT_TIMESTAMP + AND ms.status = com.back.domain.mentoring.slot.constant.MentorSlotStatus.AVAILABLE + THEN com.back.domain.mentoring.slot.constant.MentorSlotStatus.EXPIRED + ELSE ms.status + END, r.id ) FROM MentorSlot ms