Skip to content

Conversation

@xoruddl
Copy link
Member

@xoruddl xoruddl commented Sep 4, 2025

📝 개요
이번 PR의 핵심 내용을 한 줄로 요약해 주세요.

💻 작업 내용
이번 PR에서 작업한 내용을 상세히 설명해 주세요.

작업 내용 1
작업 내용 2
...

✅ PR 체크리스트
PR을 보내기 전에 아래 체크리스트를 확인해 주세요.

커밋 메시지는 포맷에 맞게 작성했나요?
스스로 코드를 다시 한번 검토했나요?
관련 이슈를 연결했나요?
빌드 및 테스트가 로컬에서 성공했나요?

🔗 관련 이슈

스크린샷 (선택)
UI 변경 사항이 있다면 스크린샷을 첨부해 주세요.

Summary by CodeRabbit

  • 버그 수정
    • 물주기·햇빛 주기 시간 계산과 일일/쿨다운 기준을 한국 표준시로 일원화해 지역/서버 시간 차이에 따른 오동작을 방지했습니다.
    • 정원 관련 오류 상황에서 더 일관된 에러 응답을 제공합니다.
    • 일기 작성자 프로필 이미지 조회 시 아바타가 없는 경우에도 안전하게 처리되며, 이 경우 이미지는 표시되지 않을 수 있습니다.
  • 테스트
    • 저장소 기반 통합 테스트로 전환해 퍼시스턴스, 쿨다운, 예외 흐름 검증을 강화했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Sep 4, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

이 PR은 시간대 처리를 Asia/Seoul로 일원화하고, GardenService의 물주기/햇빛 로직과 예외 처리 흐름을 수정했으며, DiaryInfoResponse의 아바타 기반 프로필 이미지 조회를 NPE 안전하게 변경하고, 테스트를 Mockito 단위 테스트에서 DataJpaTest 기반 통합 스타일로 전환했습니다.

Changes

Cohort / File(s) Summary
Timezone normalization in domain
src/main/java/.../garden/domain/Garden.java
타임스탬프 기록 시 ZoneId.of("Asia/Seoul") 사용으로 변경(recordOwnerWateringTime, recordFriendWateringTime, recordSunlightTime). ZoneId import 추가. 외부 API 시그니처 변화 없음.
Service logic: timezone + exceptions
src/main/java/.../garden/service/GardenService.java
모든 시간 계산을 서울시간 기반으로 통일. 물주기/친구 물주기/햇빛 로직에서 nowInSeoul 사용. 햇빛 로직의 6시 기준 계산 헬퍼 정비. IllegalArgumentException/IllegalStateExceptionCustomApiExceptionErrorCode로 표준화. 주석으로 시간대 가정 명시.
Diary response null-safety
src/main/java/.../mission/diary/dto/response/DiaryInfoResponse.java
사용자 아바타 목록에서 첫 아바타 이미지 URL을 null-safe하게 추출. 아바타 미존재 시 profileImageUrl이 null일 수 있음. 구조/시그니처 변경 없음.
Tests migration to DataJpaTest
src/test/java/.../garden/service/GardenServiceTest.java
Mockito 단위 테스트를 JPA 통합 스타일로 전환. 실제 리포지토리 autowire 및 서비스 수동 조립. 감사 필드 검증, 미존재 가든 예외, 햇빛 쿨다운 예외 경로 통합 테스트 추가/수정.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant S as GardenService
  participant G as Garden
  participant R as GardenRepository

  Note over S: 모든 시간 계산은 Asia/Seoul 기반(nowInSeoul)
  U->>S: waterOwnGarden(gardenId)
  S->>R: findById(gardenId)
  alt not found
    S-->>U: throw CustomApiException(GARDEN_NOT_FOUND)
  else found
    S->>S: check 8h cooldown (nowInSeoul)
    alt cooling
      S-->>U: throw CustomApiException(WATER_COOL_DOWN)
    else allowed
      S->>G: recordOwnerWateringTime(nowInSeoul)
      S->>R: save(G)
      S-->>U: return success
    end
  end
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant S as GardenService
  participant G as Garden
  participant R as GardenRepository

  Note over S: 햇빛 일자 시작 = 매일 06:00(Asia/Seoul)
  U->>S: sunlightGarden(gardenId)
  S->>R: findById(gardenId)
  alt not found
    S-->>U: throw CustomApiException(GARDEN_NOT_FOUND)
  else found
    S->>S: getStartOfCurrentSunlightDay()
    S->>S: validate access
    alt unauthorized
      S-->>U: throw CustomApiException(ACCESS_DENIED)
    else authorized
      S->>S: check daily limit since 06:00
      alt already given today
        S-->>U: throw CustomApiException(SUNLIGHT_COOL_DOWN)
      else allowed
        S->>G: recordSunlightTime(nowInSeoul)
        S->>R: save(G)
        S-->>U: return success
      end
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

Poem

새벽 여섯, 해가 펄쩍, 서울 시간 딱 맞춰
물방울 톡, 햇살 쏙, 정원 일지 꽉 채워
아바타 웃고, 로그 반짝, 냉down도 착착!
깡총깡총 코드밭에 발자국 남기네
오늘도 PR 한 송이, 🌱 토끼가 심었네 🐰


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2b69d12 and 1034003.

📒 Files selected for processing (4)
  • src/main/java/com/example/cp_main_be/domain/garden/garden/domain/Garden.java (2 hunks)
  • src/main/java/com/example/cp_main_be/domain/garden/garden/service/GardenService.java (4 hunks)
  • src/main/java/com/example/cp_main_be/domain/mission/diary/dto/response/DiaryInfoResponse.java (2 hunks)
  • src/test/java/com/example/cp_main_be/domain/garden/service/GardenServiceTest.java (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch leetk/refactor

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@xoruddl xoruddl merged commit 2911465 into develop Sep 4, 2025
5 of 6 checks passed
@xoruddl xoruddl deleted the leetk/refactor branch September 4, 2025 01:11
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.

2 participants