Skip to content

Commit

Permalink
Merge pull request #55 from HanaFun/feat/category
Browse files Browse the repository at this point in the history
Feat/category
  • Loading branch information
yubin-im authored Jul 3, 2024
2 parents 7a8058d + 81cae7f commit 935c5bd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public ResponseEntity<ApiResponse> myPage(@AuthenticationPrincipal Long userId)

// 나의 신청 클래스 데이터 출력
@GetMapping("/my/lessons")
public ResponseEntity<ApiResponse> myLessons(@RequestBody MyPageReqDto myPageReqDto) {
List<ReservationList> lessons = reservationService.myLessons(myPageReqDto);
public ResponseEntity<ApiResponse> myLessons(@AuthenticationPrincipal Long userId) {
List<ReservationList> lessons = reservationService.myLessons(userId);
return ResponseEntity.ok(new ApiResponse<>(true, "ok", lessons));
}

// 신청 클래스 일정 데이터 출력
@GetMapping("/my/schedule")
public ResponseEntity<ApiResponse> mySchedules(@RequestBody MyScheduleReqDto myScheduleReqDto) {
List<MyScheduleResDto> mySchedules = reservationService.mySchedules(myScheduleReqDto);
public ResponseEntity<ApiResponse> mySchedules(@AuthenticationPrincipal Long userId, @RequestBody MyScheduleReqDto myScheduleReqDto) {
List<MyScheduleResDto> mySchedules = reservationService.mySchedules(userId, myScheduleReqDto);
return ResponseEntity.ok(new ApiResponse<>(true, "ok", mySchedules));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@Getter
public class MyScheduleReqDto {
private Long userId;
private int year;
private int month;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public interface ReservationService {
MyPageResDto myPage(Long userId);

// 나의 신청 클래스 데이터 출력
List<ReservationList> myLessons(MyPageReqDto myPageReqDto);
List<ReservationList> myLessons(Long userId);

// 신청 클래스 일정 데이터 출력
List<MyScheduleResDto> mySchedules(MyScheduleReqDto myScheduleReqDto);
List<MyScheduleResDto> mySchedules(Long userId, MyScheduleReqDto myScheduleReqDto);

// 개설 클래스 상세- 강좌날짜 별 예약자 정보 출력
LessonDateDetailResDto lessonDateDetail(LessonDateDetailReqDto lessonDateDetailReqDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public MyPageResDto myPage(Long userId) {
// 나의 신청 클래스 데이터 출력
@Transactional
@Override
public List<ReservationList> myLessons(MyPageReqDto myPageReqDto) {
UserEntity user = userRepository.findById(myPageReqDto.getUserId()).orElseThrow(() -> new UserNotFoundException());
public List<ReservationList> myLessons(Long userId) {
UserEntity user = userRepository.findById(userId).orElseThrow(() -> new UserNotFoundException());
List<ReservationEntity> reservations = reservationRepository.findReservationEntitiesByUserEntity(user);

List<ReservationList> lessons = reservations.stream()
Expand Down Expand Up @@ -104,8 +104,8 @@ public List<ReservationList> myLessons(MyPageReqDto myPageReqDto) {
// 신청 클래스 일정 데이터 출력
@Transactional
@Override
public List<MyScheduleResDto> mySchedules(MyScheduleReqDto myScheduleReqDto) {
UserEntity user = userRepository.findById(myScheduleReqDto.getUserId()).orElseThrow(() -> new UserNotFoundException());
public List<MyScheduleResDto> mySchedules(Long userId, MyScheduleReqDto myScheduleReqDto) {
UserEntity user = userRepository.findById(userId).orElseThrow(() -> new UserNotFoundException());
List<ReservationEntity> reservations = reservationRepository.findReservationEntitiesByUserEntity(user);

List<MyScheduleResDto> mySchedules = reservations.stream()
Expand Down

0 comments on commit 935c5bd

Please sign in to comment.