-
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 7 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/students/{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. {studyId}가 맨앞에 오는게 좋을거같아요! /mentor/studies/{studyId} 이렇게요! |
||
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.gdschongik.gdsc.domain.study.domain; | ||
|
||
import static com.gdschongik.gdsc.global.exception.ErrorCode.STUDY_MENTOR_INVALID; | ||
|
||
import com.gdschongik.gdsc.global.annotation.DomainService; | ||
import com.gdschongik.gdsc.global.exception.CustomException; | ||
|
||
@DomainService | ||
public class StudyValidator { | ||
public void validateStudyMentor(Long currentMemberId, Long mentorId) { | ||
if (!currentMemberId.equals(mentorId)) { | ||
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. 이러면 어드민이 접근할 수 없지 않나요? |
||
throw new CustomException(STUDY_MENTOR_INVALID); | ||
} | ||
} | ||
} |
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.