-
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: 시간표 프레임 한번에 조회 구현 #1108
feat: 시간표 프레임 한번에 조회 구현 #1108
Changes from 2 commits
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 |
---|---|---|
|
@@ -77,7 +77,7 @@ ResponseEntity<TimetableFrameUpdateResponse> updateTimetableFrame( | |
@Operation(summary = "시간표 프레임 조회") | ||
@SecurityRequirement(name = "Jwt Authentication") | ||
@GetMapping("/v2/timetables/frame") | ||
ResponseEntity<List<TimetableFrameResponse>> getTimetablesFrame( | ||
ResponseEntity<Object> getTimetablesFrame( | ||
@RequestParam(name = "semester") String semester, | ||
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. C여기에도 required 옵션 줘야 하나용 ?? 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. 오 꼼꼼하시네요bb |
||
@Auth(permit = {STUDENT}) Integer userId | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,9 @@ | |
import static in.koreatech.koin.domain.timetableV2.validation.TimetableFrameValidate.validateUserAuthorization; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.stream.Collectors; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
@@ -57,13 +59,30 @@ public TimetableFrameUpdateResponse updateTimetableFrame( | |
return timetableFrameUpdater.updateTimetableFrame(frame, userId, request.timetableName(), request.isMain()); | ||
} | ||
|
||
public List<TimetableFrameResponse> getTimetablesFrame(Integer userId, String semesterRequest) { | ||
public Object getTimetablesFrame(Integer userId, String semesterRequest) { | ||
if (semesterRequest == null) { | ||
return getAllTimetablesFrame(userId); | ||
} | ||
|
||
Semester semester = semesterRepositoryV2.getBySemester(semesterRequest); | ||
return timetableFrameRepositoryV2.findAllByUserIdAndSemesterId(userId, semester.getId()).stream() | ||
.map(TimetableFrameResponse::from) | ||
.toList(); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
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. C클래스에 readOnly 트랜잭션이 걸려있는데, 여기에 추가하신 이유가 궁금합니다 ! 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 Map<String, Map<String, List<TimetableFrameResponse>>> getAllTimetablesFrame(Integer userId) { | ||
List<TimetableFrame> timetableFrames = timetableFrameRepositoryV2.findAllByUserId(userId); | ||
|
||
Map<String, List<TimetableFrameResponse>> groupedBySemester = timetableFrames.stream() | ||
.collect(Collectors.groupingBy( | ||
frame -> frame.getSemester().getSemester(), | ||
Collectors.mapping(TimetableFrameResponse::from, Collectors.toList()) | ||
)); | ||
|
||
return Map.of("semesters", groupedBySemester); | ||
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. Cdto 클래스로 반환할 수 있을 것 같아요. 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. 그냥 생각없이 만들어서 바로 올리고 씻으면서 dto로 변환해야겠다 바로 생각이 들었었습니다..ㅎㅎ |
||
} | ||
|
||
@Transactional | ||
public void deleteAllTimetablesFrame(Integer userId, String semester) { | ||
User user = userRepository.getById(userId); | ||
|
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.
R
이거 왜 인지 모르겠는데, 컨트롤러랑 API Path가 다르네요..? 뭐지뭐지
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.
이미 클라에서 적용이 됐을 것 같은데
/v2/timetables/frame
은 기존 방식,/v2/timetables/frames
는 새로운 방식으로 나눠도 좋을 것 같아요. 대응이 필요한,,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.
스웨거에는 기존꺼도 /v2/timetables/frames로 올라가있네요!
저는 그래서 그냥 지금처럼 해도 되지 않을까 하는데 어떻게 생각하시나요
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.
좋습니당