Skip to content

feat: 예약 가능한 시간 테이블 계산해서 반환#154

Open
yuuuyeonho wants to merge 12 commits intodevelopfrom
feature/153-availabe-timetable
Open

feat: 예약 가능한 시간 테이블 계산해서 반환#154
yuuuyeonho wants to merge 12 commits intodevelopfrom
feature/153-availabe-timetable

Conversation

@yuuuyeonho
Copy link
Contributor

작업 내용

  • 예약 가능한 시간 테이블 계산해서 반환

특이 사항 (리뷰 시 참고할 내용)

  • 웹 측에서 사용가능한 시간이 아니라 불가능한 시간 인덱스를 알려달라고 요청해서 불가능한 시간의 인덱스 리스트를 반환합니다

관련 이슈

close #153

@yuuuyeonho yuuuyeonho requested review from Fluteen and kckc0608 October 3, 2025 13:57
@yuuuyeonho yuuuyeonho added the 🐞bug 버그 발생 label Oct 3, 2025
@yuuuyeonho yuuuyeonho linked an issue Oct 3, 2025 that may be closed by this pull request
Copy link
Contributor

@Fluteen Fluteen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다👍👍!! 괜찮은 것 같은데 다른 의견이 생각나서 아래 코멘트 남깁니다!

지금 service 로직에서는 일단 슬롯을 다 true로 두고 applyReservationToSlots에서 최종 비교해서 false로 바꾸고 그 친구들만 list에 포함시키는거로 이해했습니다.

혹시 통일성을 위해 service 로직에 불가능한 시간 테이블을 구하는 로직으로 짜면 어떨까요?? 최종적으로 반환하는건 불가능한 시간 슬롯 리스트니까..ㅎ

Copy link
Member

@kckc0608 kckc0608 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! 코멘트 내용 확인 부탁드립니다~!

Comment on lines +191 to +205
Optional<DailySchedule> optionalDailySchedule = dailyScheduleRepository.findByDate(date);

// 일간 스케줄이 있을 경우 계산, 없을 경우 주간 스케줄로 계산
if(optionalDailySchedule.isPresent()){
DailySchedule dailySchedule = optionalDailySchedule.get();
boolean[] slots = generateDailySlots(dailySchedule.getStartTime(), dailySchedule.getEndTime());
applyReservationsToSlots(slots,reservations);
return DailyAvailableResponse.of(date, dailySchedule.isActive(), slots);
} else {
WeeklySchedule weeklySchedule = weeklyScheduleRepository.findByDayOfWeek(date.getDayOfWeek())
.orElseThrow(() -> new ReservationException(WEEKLY_SCHEDULE_NOT_FOUND));
boolean[] slots = generateDailySlots(weeklySchedule.getStartTime(), weeklySchedule.getEndTime());
applyReservationsToSlots(slots,reservations);
return DailyAvailableResponse.of(date, weeklySchedule.isActive(), slots);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 로직 map().orElse() 로 더 간결하게 작성 가능할 거 같아용

a.findByDate()
    .map(data -> DailyAvailableResponse.of())
    .orElse(DailyAvailableResponse.of());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generateDailySlots() 메서드에서 DailySchedule 과 reservation 을 인자로 받고, 내부에서 일간 스케줄 기반 슬롯 설정, 기존 예약 기반 슬롯 설정 로직을 나눠 작성하면 더 좋을 것 같아용

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 궁금한 점이 하나 있는데, 관리자 화면에서 slot 과 관련된 화면이 있나요?? 일별로 예약 가능 시간의 시작 시간, 종료시간을 보는 API 만 있었던 거 같은데, 그 API 에서도 슬롯으로 응답하나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 관리자 api로도 연결되어있는걸 생각을 못했네요...아마 관리자는 원래 응답하던대로 응답해야할 것 같습니다. 프론트와 얘기해보고 작업하겠습니다!

@yuuuyeonho
Copy link
Contributor Author

yuuuyeonho commented Jan 13, 2026

  • 관리자 api -> 기존 응답 유지
  • 사용자 api -> 예약 불가능한 시간 총 계산해서 응답
  • 두개 api의 서비스 코드가 따로 나눠지면서 사용자 api 서비스 코드는 ReservationService로 이동
  • 응답코드에 맞게 메소드 리네이밍

작업했습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞bug 버그 발생

Projects

None yet

Development

Successfully merging this pull request may close these issues.

스케줄에 따라 예약 가능한 시간 반환

3 participants