Skip to content

Conversation

@HoyeongJeon
Copy link
Collaborator

@HoyeongJeon HoyeongJeon commented May 7, 2025

✅ PR 유형

어떤 변경 사항이 있었나요?

  • 새로운 기능 추가
  • 버그 수정
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

📝 작업 내용

  • 일정을 가져올 때 , 일정의 시작 날짜와 종료 날짜 사이에 겹쳐있는 일정이라면 모두 가져오기

✏️ 관련 이슈


🎸 기타 사항 or 추가 코멘트

Summary by CodeRabbit

  • 버그 수정
    • 일정 조회 시 시작일뿐만 아니라 일정 기간 전체를 고려하여 조회하도록 개선되었습니다. 이제 지정한 날짜가 일정 기간 내에 포함될 경우 해당 일정이 조회됩니다.
  • 리팩터
    • 일정 조회 관련 메서드 명칭이 실제 동작을 더 잘 반영하도록 변경되었습니다.
  • 스타일
    • 날짜 및 시간 형식이 일관되게 포맷팅되어 반환됩니다.

@HoyeongJeon HoyeongJeon self-assigned this May 7, 2025
@HoyeongJeon HoyeongJeon requested a review from kimyeoungrok May 7, 2025 06:48
@coderabbitai
Copy link

coderabbitai bot commented May 7, 2025

Walkthrough

이 변경 사항은 Jackson의 날짜/시간 직렬화 포맷을 명확히 지정하고, 일정 조회 시 시작일뿐만 아니라 일정 기간 전체를 고려하도록 ScheduleRepository와 ScheduleService의 쿼리 및 메서드 명을 수정합니다. 공개 API 시그니처는 ScheduleRepository에서만 일부 변경되었습니다.

Changes

파일/경로 변경 요약
.../core/configuration/jackson/JacksonConfig.kt JacksonConfig에 날짜/시간 포맷 상수 및 포매터를 companion object로 추가, JavaTimeModule에 커스텀 직렬화기 명시적으로 등록, 날짜를 타임스탬프가 아닌 문자열로 직렬화하도록 설정을 명확히 함.
.../schedule/domain/repository/ScheduleRepository.kt 일정 조회 메서드의 이름과 쿼리 조건을 일정 시작일 기준에서 일정 기간 전체(시작일~종료일이 주어진 범위와 겹치는지)로 변경. 메서드 시그니처도 이에 맞게 수정됨.
.../schedule/domain/service/ScheduleService.kt 내부적으로 변경된 Repository 메서드를 호출하도록 수정. 공개 함수 시그니처에는 변화 없음.

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>
Loading
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>
Loading

Suggested reviewers

  • kimyeoungrok

Poem

🐇
날짜 포맷을 딱 맞춰,
일정 찾기도 똑똑하게!
시작일만 보던 눈,
이제는 범위도 본다네.
깔끔한 직렬화,
더 똑똑해진 서비스,
토끼도 박수 짝짝짝!

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56fcaa6 and 4d365bd.

📒 Files selected for processing (1)
  • src/main/kotlin/gomushin/backend/core/configuration/jackson/JacksonConfig.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/kotlin/gomushin/backend/core/configuration/jackson/JacksonConfig.kt
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HoyeongJeon HoyeongJeon changed the title Issue/#88 consecutive scheduels Issue: (#88) 연속된 날짜의 일정 가져오기 May 7, 2025
Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7fc5cb5 and bef271d.

📒 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 메서드의 매개변수 목록이 적절하게 업데이트되어 CustomAccessDeniedHandlerCustomAuthenticationEntryPoint를 모두 의존성 주입으로 받도록 변경되었습니다. 이는 Spring의 의존성 주입 패턴을 따르는 좋은 방식입니다.


73-73: 인증 진입점 설정 추가

Spring Security 설정에 customAuthenticationEntryPoint가 적절하게 추가되었습니다. 이제 인증되지 않은 사용자의 요청이 들어올 때 커스텀 응답을 제공할 수 있게 되었습니다. 이는 사용자 경험을 향상시키는 좋은 개선사항입니다.


71-74: 보안 구성 전체 평가

보안 예외 처리에 대한 설정이 체계적으로 개선되었습니다. 접근 거부 핸들러와 인증 진입점을 모두 설정하여 권한 오류와 인증 오류에 대한 일관된 JSON 응답을 제공할 수 있게 되었습니다. 이는 RESTful API 서비스에서 중요한 요소입니다.

@HoyeongJeon HoyeongJeon force-pushed the issue/#88-consecutive-scheduels branch from bef271d to 56fcaa6 Compare May 7, 2025 14:33
Copy link
Contributor

@kimyeoungrok kimyeoungrok left a comment

Choose a reason for hiding this comment

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

@HoyeongJeon HoyeongJeon force-pushed the issue/#88-consecutive-scheduels branch from 56fcaa6 to 889905b Compare May 8, 2025 02:02
@HoyeongJeon HoyeongJeon force-pushed the issue/#88-consecutive-scheduels branch from 889905b to 4d365bd Compare May 8, 2025 02:02
@HoyeongJeon HoyeongJeon merged commit 4ec8972 into main May 8, 2025
1 check passed
@HoyeongJeon HoyeongJeon deleted the issue/#88-consecutive-scheduels branch May 8, 2025 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

연속 일정 수정

3 participants