-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 스터디 수강생 명단 조회 #623
feat: 스터디 수강생 명단 조회 #623
Changes from 4 commits
9de4594
46bce0c
59eeb9a
456ee61
a9465b6
73c601d
019ca34
90846e6
55f4ce6
90f22ff
a5c3d2e
05f9f6e
dc87777
2f28e48
3a3bc02
6aeede4
ee35677
9790339
7fc485d
aa9a407
203449b
7e5c230
758a038
b870af0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,14 @@ | |
|
||
import com.gdschongik.gdsc.domain.study.application.MentorStudyService; | ||
import com.gdschongik.gdsc.domain.study.dto.response.MentorStudyResponse; | ||
import com.gdschongik.gdsc.domain.study.dto.response.StudyStudentResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
@@ -25,4 +27,11 @@ public ResponseEntity<List<MentorStudyResponse>> getStudiesInCharge() { | |
List<MentorStudyResponse> response = mentorStudyService.getStudiesInCharge(); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@Operation(summary = "내 스터디 수강생 명단 조회", description = "내가 멘토로 있는 스터디 수강생 명단을 조회합니다") | ||
@GetMapping("/me/{studyId}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앗 다른 controller랑 겹치지 않아서 단순히 이렇게 해놨는데 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 그럼 내 학생들의 스터디를 조회한다는 의미가 되는데, 더 적절해지지 않아질 것 같습니다 |
||
public ResponseEntity<List<StudyStudentResponse>> getStudyStudents(@PathVariable Long studyId) { | ||
List<StudyStudentResponse> response = mentorStudyService.getStudyStudents(studyId); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,8 @@ public static Study createStudy( | |
.build(); | ||
} | ||
|
||
// 검증 로직 | ||
|
||
private static void validateApplicationStartDateBeforeSessionStartDate( | ||
LocalDateTime applicationStartDate, LocalDateTime startDate) { | ||
if (!applicationStartDate.isBefore(startDate)) { | ||
|
@@ -163,6 +165,12 @@ private static void validateAssignmentLineStudyTime(LocalTime studyStartTime, Lo | |
} | ||
} | ||
|
||
public void validateMentor(Member currentMember) { | ||
if (currentMember != mentor) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 엔티티는 id로 동등 여부를 확인합니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앗 넵 studyValidator만들어서 따로 구현하겠습니다 |
||
throw new CustomException(STUDY_MENTOR_INVALID); | ||
} | ||
} | ||
|
||
// 데이터 전달 로직 | ||
public boolean isApplicable() { | ||
return applicationPeriod.isOpen(); | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||
package com.gdschongik.gdsc.domain.study.dto.response; | ||||||||||
|
||||||||||
import com.gdschongik.gdsc.domain.study.domain.StudyHistory; | ||||||||||
import io.swagger.v3.oas.annotations.media.Schema; | ||||||||||
|
||||||||||
public record StudyStudentResponse( | ||||||||||
@Schema(description = "멤버 아이디") Long memberId, | ||||||||||
@Schema(description = "학생 이름") String name, | ||||||||||
@Schema(description = "학번") String studentId, | ||||||||||
@Schema(description = "디스코드 사용자명") String discordName, | ||||||||||
@Schema(description = "디스코드 닉네임") String discordUsername, | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
@Schema(description = "깃허브 링크") String githubLink) { | ||||||||||
public static StudyStudentResponse from(StudyHistory studyHistory) { | ||||||||||
return new StudyStudentResponse( | ||||||||||
studyHistory.getMentee().getId(), | ||||||||||
studyHistory.getMentee().getName(), | ||||||||||
studyHistory.getMentee().getStudentId(), | ||||||||||
studyHistory.getMentee().getDiscordId(), | ||||||||||
studyHistory.getMentee().getDiscordUsername(), | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
studyHistory.getRepositoryLink()); | ||||||||||
} | ||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.