diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java b/src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java index e74145482..bc74e9a7b 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java @@ -3,6 +3,7 @@ import com.gdschongik.gdsc.domain.study.application.MentorStudyDetailService; import com.gdschongik.gdsc.domain.study.dto.request.AssignmentCreateUpdateRequest; import com.gdschongik.gdsc.domain.study.dto.response.AssignmentResponse; +import com.gdschongik.gdsc.domain.study.dto.response.StudySessionResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; @@ -62,4 +63,12 @@ public ResponseEntity cancelStudyAssignment(@PathVariable Long studyDetail mentorStudyDetailService.cancelStudyAssignment(studyDetailId); return ResponseEntity.noContent().build(); } + + // TODO 스터디 세션 워딩을 커리큘럼으로 변경해야함 + @Operation(summary = "스터디 주차별 커리큘럼 목록 조회", description = "멘토가 자신의 스터디 커리큘럼 목록을 조회합니다") + @GetMapping("/sessions") + public ResponseEntity> getStudySessions(@RequestParam(name = "study") Long studyId) { + List response = mentorStudyDetailService.getSessions(studyId); + return ResponseEntity.ok(response); + } } diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java b/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java index a6c3c5485..48fbd4622 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java @@ -8,6 +8,7 @@ import com.gdschongik.gdsc.domain.study.domain.StudyDetailValidator; import com.gdschongik.gdsc.domain.study.dto.request.AssignmentCreateUpdateRequest; import com.gdschongik.gdsc.domain.study.dto.response.AssignmentResponse; +import com.gdschongik.gdsc.domain.study.dto.response.StudySessionResponse; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.global.util.MemberUtil; import java.util.List; @@ -83,4 +84,10 @@ public void updateStudyAssignment(Long studyDetailId, AssignmentCreateUpdateRequ log.info("[MentorStudyDetailService] 과제 수정 완료: studyDetailId={}", studyDetailId); } + + @Transactional(readOnly = true) + public List getSessions(Long studyId) { + List studyDetails = studyDetailRepository.findAllByStudyId(studyId); + return studyDetails.stream().map(StudySessionResponse::from).toList(); + } } diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudySessionResponse.java b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudySessionResponse.java new file mode 100644 index 000000000..5c40f046e --- /dev/null +++ b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudySessionResponse.java @@ -0,0 +1,19 @@ +package com.gdschongik.gdsc.domain.study.dto.response; + +import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.study.domain.Difficulty; +import com.gdschongik.gdsc.domain.study.domain.StudyDetail; +import com.gdschongik.gdsc.domain.study.domain.vo.Session; + +public record StudySessionResponse(Long studyDetailId, Period period, Long week, String title, Difficulty difficulty) { + + public static StudySessionResponse from(StudyDetail studyDetail) { + Session session = studyDetail.getSession(); + return new StudySessionResponse( + studyDetail.getId(), + studyDetail.getPeriod(), + studyDetail.getWeek(), + session.getTitle(), + session.getDifficulty()); + } +}