-
Notifications
You must be signed in to change notification settings - Fork 0
Issue: (#88) 연속된 날짜의 일정 가져오기 #92
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
Conversation
Walkthrough이 변경 사항은 Jackson의 날짜/시간 직렬화 포맷을 명확히 지정하고, 일정 조회 시 시작일뿐만 아니라 일정 기간 전체를 고려하도록 ScheduleRepository와 ScheduleService의 쿼리 및 메서드 명을 수정합니다. 공개 API 시그니처는 ScheduleRepository에서만 일부 변경되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant ScheduleService
participant ScheduleRepository
Controller->>ScheduleService: findByDate(coupleId, date)
ScheduleService->>ScheduleRepository: findByCoupleIdAndDate(coupleId, date)
ScheduleRepository-->>ScheduleService: List<DailyScheduleResponse>
ScheduleService-->>Controller: List<DailyScheduleResponse>
sequenceDiagram
participant Controller
participant ScheduleService
participant ScheduleRepository
Controller->>ScheduleService: findByCoupleIdAndDateBetween(coupleId, startDate, endDate)
ScheduleService->>ScheduleRepository: findByCoupleIdAndStartDateAndEndDateBetween(coupleId, startDate, endDate)
ScheduleRepository-->>ScheduleService: List<MainSchedulesResponse>
ScheduleService-->>Controller: List<MainSchedulesResponse>
Suggested reviewers
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/kotlin/gomushin/backend/core/infrastructure/filter/CustomAuthenticationEntryPoint.kt (1)
1-36: 코드 구조 보완 제안인증 실패 시 발생할 수 있는 다양한 예외 상황에 따라 더 세분화된 에러 코드를 제공하는 것이 좋을 것 같습니다. 현재는 모든 인증 실패에 대해 동일한 에러 코드를 사용하고 있지만, 예외 유형에 따라 다른 에러 코드를 반환하면 클라이언트에서 더 구체적인 오류 처리가 가능할 것입니다.
예를 들어, 다음과 같이 구현할 수 있습니다:
- val exception = ErrorCodeResolvingApiErrorException( - ExtendedHttpStatus.UNAUTHORIZED, - "sarangggun.auth.unauthorized" - ) + val errorCode = when (authException) { + is BadCredentialsException -> "sarangggun.auth.bad-credentials" + is AccountExpiredException -> "sarangggun.auth.account-expired" + is LockedException -> "sarangggun.auth.account-locked" + else -> "sarangggun.auth.unauthorized" + } + + val exception = ErrorCodeResolvingApiErrorException( + ExtendedHttpStatus.UNAUTHORIZED, + errorCode + )src/main/kotlin/gomushin/backend/core/configuration/security/SecurityConfiguration.kt (1)
71-74: 보안 설정 로깅 추가 제안보안 예외 발생 시 로깅을 추가하면 문제 해결과 모니터링에 도움이 될 것입니다. 현재 구현에서는 응답만 보내고 있지만, 어떤 요청에서 인증/인가 실패가 발생했는지 로깅하면 보안 감사 및 디버깅에 유용할 것입니다.
예를 들어, CustomAuthenticationEntryPoint와 CustomAccessDeniedHandler에 로깅을 추가할 수 있습니다:
// 로깅 추가 예시 private val logger = LoggerFactory.getLogger(CustomAuthenticationEntryPoint::class.java) override fun commence(...) { logger.warn("인증 실패: ${request?.requestURI}, 메서드: ${request?.method}, 원인: ${authException?.message}") // 기존 코드... }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/main/kotlin/gomushin/backend/core/configuration/jackson/JacksonConfig.kt(1 hunks)src/main/kotlin/gomushin/backend/core/configuration/security/SecurityConfiguration.kt(3 hunks)src/main/kotlin/gomushin/backend/core/infrastructure/filter/CustomAuthenticationEntryPoint.kt(1 hunks)src/main/kotlin/gomushin/backend/core/oauth/handler/CustomAccessDeniedHandler.kt(2 hunks)src/main/kotlin/gomushin/backend/schedule/domain/repository/ScheduleRepository.kt(2 hunks)src/main/kotlin/gomushin/backend/schedule/domain/service/ScheduleService.kt(2 hunks)
🔇 Additional comments (19)
src/main/kotlin/gomushin/backend/schedule/domain/repository/ScheduleRepository.kt (4)
48-48: 쿼리 조건이 개선되었습니다.날짜 필터링 로직이 일정의 시작일만 고려하던 방식에서 시작일과 종료일 사이의 모든 날짜를 고려하는 방식으로 변경되었습니다. 이 변경은 특정 날짜가 일정 기간 내에 포함되는지 확인하는 더 정확한 방식입니다.
51-51: 메소드 이름이 더 명확해졌습니다.메소드 이름이
findByCoupleIdAndStartDate에서findByCoupleIdAndDate로 변경되어 실제 구현 내용을 더 잘 반영합니다. 이제 시작일뿐만 아니라, 일정 전체 기간 내의 날짜로 필터링한다는 의미가 명확합니다.
64-65: 겹치는 일정 검색 로직이 개선되었습니다.쿼리 조건이 일정의 시작일만 고려하는 방식에서, 지정된 날짜 범위와 일정 기간이 겹치는지 확인하는 방식으로 변경되었습니다. 이 변경으로 다음의 조건을 충족하는 일정들이 모두 검색됩니다:
- 일정 시작일이 검색 종료일보다 이전이거나 같음 (s.startDate <= :endDate)
- 일정 종료일이 검색 시작일보다 이후이거나 같음 (s.endDate >= :startDate)
이렇게 하면 검색 기간과 일정 기간이 조금이라도 겹치는 모든 일정을 가져올 수 있습니다.
68-68: 메소드 이름이 구현 내용과 일치하게 변경되었습니다.메소드 이름이
findByCoupleIdAndStartDateBetween에서findByCoupleIdAndStartDateAndEndDateBetween으로 변경되어 실제 필터링 로직을 더 정확하게 반영합니다. 이 이름은 시작일과 종료일을 모두 고려하여 검색한다는 의미를 명확히 합니다.src/main/kotlin/gomushin/backend/schedule/domain/service/ScheduleService.kt (2)
31-31: 리포지토리 메소드 호출이 일관되게 업데이트되었습니다.서비스 계층에서 리포지토리 메소드 호출이
findByCoupleIdAndStartDateBetween에서findByCoupleIdAndStartDateAndEndDateBetween으로 변경되었습니다. 이는 리포지토리 인터페이스의 변경사항과 일치하며, 일정 검색 로직의 개선을 서비스 계층에서도 적용합니다.
40-40: 리포지토리 메소드 호출이 일관되게 업데이트되었습니다.서비스 계층에서 리포지토리 메소드 호출이
findByCoupleIdAndStartDate에서findByCoupleIdAndDate로 변경되었습니다. 이는 리포지토리 인터페이스의 변경사항과 일치하며, 특정 날짜에 대한 일정 검색 로직의 개선을 서비스 계층에서도 적용합니다.src/main/kotlin/gomushin/backend/core/configuration/jackson/JacksonConfig.kt (2)
3-7: 필요한 Jackson 모듈 및 기능을 위한 임포트 추가Jackson ObjectMapper 설정 강화를 위해 필요한 추가 임포트가 적절하게 추가되었습니다. 특히 JavaTimeModule 및 KotlinModule 추가는 Java 시간 타입과 Kotlin 특화 기능 지원에 중요합니다.
15-21: ObjectMapper 설정 개선ObjectMapper의 설정이 적절하게 개선되었습니다:
- JavaTimeModule 등록으로 Java 8 날짜/시간 타입 처리 개선
- KotlinModule 등록으로 Kotlin 데이터 클래스 및 null 안전성 지원
- 시간 데이터 직렬화 설정 및 알 수 없는 속성에 대한 유연한 역직렬화 처리
이러한 설정은 날짜/시간 관련 데이터를 다루는 일정 조회 기능 개선에 필수적입니다.
src/main/kotlin/gomushin/backend/core/oauth/handler/CustomAccessDeniedHandler.kt (3)
15-15: ObjectMapper 의존성 주입 개선기존에 내부에서 ObjectMapper를 직접 생성하던 방식에서 생성자를 통한 의존성 주입 방식으로 변경하여 중앙 집중식 Jackson 설정을 활용할 수 있게 되었습니다. 이는 객체지향 설계 원칙을 더 잘 준수하며 일관된 JSON 직렬화를 보장합니다.
28-32: 에러 코드 결정 로직 명확화에러 코드 결정 로직이 명확하게 개선되었습니다. 요청 URI에 따라 게스트 전용 온보딩 접근과 회원 전용 접근을 구분하여 적절한 에러 코드를 할당하는 방식이 명시적으로 구현되었습니다.
34-40: 응답 생성 로직 간소화예외 생성 및 JSON 직렬화 로직이 조건부 블록 외부로 이동되어 코드의 중복을 제거하고 가독성을 개선했습니다. 주입된 ObjectMapper를 사용하여 JSON 응답을 생성하는 방식이 일관되게 적용되었습니다.
src/main/kotlin/gomushin/backend/core/infrastructure/filter/CustomAuthenticationEntryPoint.kt (4)
1-12: 인증 진입점 구현을 위한 패키지 및 임포트 설정새로운
CustomAuthenticationEntryPoint클래스를 위한 패키지 구조와 필요한 임포트가 적절하게 설정되었습니다. Spring Security의 인증 예외 처리를 위해 필요한 모든 구성 요소가 포함되어 있습니다.
13-19: 인증 진입점 클래스 구현Spring Security의
AuthenticationEntryPoint인터페이스를 구현하는 클래스가 적절히 생성되었습니다. 의존성 주입을 통해ObjectMapper를 받고commence메서드를 오버라이드하여 인증 예외 처리 로직을 구현했습니다.
20-26: 응답 설정 구현인증되지 않은 요청에 대한 응답 설정이 적절하게 구현되었습니다:
- 응답이 이미 커밋된 경우 조기 반환
- JSON 콘텐츠 타입 설정
- 401 Unauthorized 상태 코드 설정
- UTF-8 인코딩 설정
이는 클라이언트에게 명확한 오류 응답을 제공하기 위한 좋은 구현입니다.
27-35: 에러 응답 생성
ErrorCodeResolvingApiErrorException을 사용하여 구조화된 에러 응답을 생성하고, 주입된ObjectMapper를 사용하여 이를 JSON으로 직렬화하는 로직이 잘 구현되었습니다. 이는CustomAccessDeniedHandler와 일관된 방식으로 처리되어 전체 애플리케이션에서 일관된 오류 응답 형식을 제공합니다.src/main/kotlin/gomushin/backend/core/configuration/security/SecurityConfiguration.kt (4)
3-3: 인증 진입점 클래스 임포트 추가새로 구현된
CustomAuthenticationEntryPoint클래스를 임포트하기 위한 구문이 적절하게 추가되었습니다.
35-36: 필터 체인 메서드 시그니처 업데이트
filterChain메서드의 매개변수 목록이 적절하게 업데이트되어CustomAccessDeniedHandler와CustomAuthenticationEntryPoint를 모두 의존성 주입으로 받도록 변경되었습니다. 이는 Spring의 의존성 주입 패턴을 따르는 좋은 방식입니다.
73-73: 인증 진입점 설정 추가Spring Security 설정에
customAuthenticationEntryPoint가 적절하게 추가되었습니다. 이제 인증되지 않은 사용자의 요청이 들어올 때 커스텀 응답을 제공할 수 있게 되었습니다. 이는 사용자 경험을 향상시키는 좋은 개선사항입니다.
71-74: 보안 구성 전체 평가보안 예외 처리에 대한 설정이 체계적으로 개선되었습니다. 접근 거부 핸들러와 인증 진입점을 모두 설정하여 권한 오류와 인증 오류에 대한 일관된 JSON 응답을 제공할 수 있게 되었습니다. 이는 RESTful API 서비스에서 중요한 요소입니다.
bef271d to
56fcaa6
Compare
kimyeoungrok
left a comment
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.
굳
56fcaa6 to
889905b
Compare
889905b to
4d365bd
Compare
✅ PR 유형
어떤 변경 사항이 있었나요?
📝 작업 내용
✏️ 관련 이슈
🎸 기타 사항 or 추가 코멘트
Summary by CodeRabbit