Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
public record MentorDetailDto(
@Schema(description = "멘토 ID")
Long mentorId,
@Schema(description = "멘토 회원 ID")
Long mentorMemberId,
@Schema(description = "멘토 닉네임")
String nickname,
@Schema(description = "평점")
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public record MentoringWithTagsDto(
List<String> tags,
@Schema(description = "멘토 ID")
Long mentorId,
@Schema(description = "멘토 회원 ID")
Long mentorMemberId,
@Schema(description = "멘토 닉네임")
String nickname
) {
Expand All @@ -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()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public record ReviewResponse(

@Schema(description = "멘티 ID")
Long menteeId,
@Schema(description = "멘티 회원 ID")
Long menteeMemberId,
@Schema(description = "멘티 닉네임")
String menteeNickname
) {
Expand All @@ -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()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public enum MentorSlotStatus {
AVAILABLE, // 예약 가능
PENDING, // 예약 승인 대기
APPROVED, // 예약 승인됨(확정)
COMPLETED // 멘토링 완료
COMPLETED, // 멘토링 완료
EXPIRED // 만료
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "종료 일시")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ public interface MentorSlotRepository extends JpaRepository<MentorSlot, Long> {
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,
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
Expand All @@ -45,6 +51,7 @@ List<MentorSlotDto> 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,
Expand All @@ -53,6 +60,7 @@ List<MentorSlotDto> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down