Skip to content

Conversation

@xoruddl
Copy link
Member

@xoruddl xoruddl commented Sep 3, 2025

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

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

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

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

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

🔗 관련 이슈

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

Summary by CodeRabbit

  • 버그 수정

    • 프로필 화면의 ‘남은 물 주기’가 프로필 소유자 기준으로 정확히 표시되도록 수정
    • 내가 다른 사용자에게 물을 줄 수 있는지 여부가 정확히 계산되도록 개선
  • 리팩터링

    • 일일 물 주기 계산을 프로필 사용자와 현재 사용자 기준으로 분리해 일관성과 가독성 향상
  • 기타 작업

    • 감사(Auditing) 설정을 활성화하여 생성/수정 시각 관리 기반을 정비(사용자 영향 없음)

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

애플리케이션에 JPA 감사(auditing)를 활성화하고, Garden 엔티티의 createdAt/updatedAt 필드 제약과 unlock() 동작을 수정했으며, UserService에서 일일 물주기 카운트를 프로필 사용자와 현재 사용자 기준으로 분리 계산하도록 로직을 재구성했습니다.

Changes

Cohort / File(s) Summary
App Auditing Enablement
src/main/java/com/example/cp_main_be/CpMainBeApplication.java
JPA 감사 활성화: @EnableJpaAuditing 추가. 기존 @SpringBootApplication, @EnableScheduling, main 메서드는 그대로.
Garden Auditing & Unlock Behavior
src/main/java/com/example/cp_main_be/domain/garden/garden/domain/Garden.java
createdAt: @Column(nullable = false)로 변경(더 이상 updatable=false 아님). updatedAt: @LastModifiedDate@Column(nullable = false) 추가. unlock(): isLocked=false에 더해 createdAt, updatedAtLocalDateTime.now()로 갱신.
User Watering Count Split
src/main/java/com/example/cp_main_be/domain/member/user/service/UserService.java
일일 물주기 카운트 로직 분리: 프로필 사용자용과 현재 사용자용 각각 계산. todayWateringCountForOthers/leftWaterCountForOthers 제거. isWateringAbleByMe는 현재 사용자 잔여 횟수 기준으로 결정. 응답의 leftWaterCountForOthers는 프로필 사용자 잔여로 매핑. 주석 정리.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as CpMainBeApplication
  participant JPA as Spring Data JPA
  Note over App: 애플리케이션 기동
  App->>JPA: EnableJpaAuditing 활성화
  JPA-->>App: 생성/수정 시간 자동 감지 준비
Loading
sequenceDiagram
  autonumber
  participant Client as Client
  participant UserSvc as UserService
  participant Repo as Repositories
  Note over Client,UserSvc: 프로필 조회 흐름(물주기 카운트 분리)
  Client->>UserSvc: getUserProfile(profileUserId, currentUserId)
  UserSvc->>Repo: 프로필 사용자 물주기 횟수 조회
  UserSvc->>Repo: 현재 사용자 물주기 횟수/대상 조회
  UserSvc->>UserSvc: 잔여 횟수 계산 (프로필 사용자, 현재 사용자 분리)
  UserSvc-->>Client: 응답 (isWateringAbleByMe, leftWaterCountForProfileUser 등)
Loading
sequenceDiagram
  autonumber
  participant Domain as Garden
  participant JPA as AuditingListener
  Note over Domain,JPA: unlock 동작 변경
  activate Domain
  Domain->>Domain: unlock()
  Domain->>Domain: isLocked = false
  Domain->>Domain: createdAt = now(), updatedAt = now()
  JPA-->>Domain: @LastModifiedDate 처리(저장 시점)
  deactivate Domain
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • lejuho
  • c5ln

Poem

토끼 개발자, 귀 쫑긋 끄덕여요 🥕
시간의 발자국, 감사로 찍고
정원 문 열며 now()로 새긴 흔적
물방울 셈은 둘로 나눠 또렷이
한 잔은 너에게, 한 잔은 나에게
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 1a70f07 and d0dacfe.

📒 Files selected for processing (3)
  • src/main/java/com/example/cp_main_be/CpMainBeApplication.java (1 hunks)
  • 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/member/user/service/UserService.java (3 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 2b69d12 into develop Sep 3, 2025
5 of 6 checks passed
@xoruddl xoruddl deleted the leetk/refactor branch September 4, 2025 00:03
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