Skip to content

Conversation

@HoyeongJeon
Copy link
Collaborator

@HoyeongJeon HoyeongJeon commented May 25, 2025

✅ PR 유형

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

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

📝 작업 내용

  • 기념일 상세조회

✏️ 관련 이슈


🎸 기타 사항 or 추가 코멘트

Summary by CodeRabbit

  • 신규 기능
    • 특정 기념일의 상세 정보를 조회할 수 있는 GET 엔드포인트가 추가되었습니다.
  • 문서화
    • 기념일 관련 API의 Swagger/OpenAPI 태그명이 "기념일 생성"에서 "기념일"로 변경되었습니다.

@HoyeongJeon HoyeongJeon self-assigned this May 25, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 25, 2025

Walkthrough

기념일 상세 정보를 조회하는 기능이 추가되었습니다. 새로운 DTO와 API 엔드포인트가 도입되었으며, 인증된 사용자가 자신의 커플에 속한 기념일만 조회할 수 있도록 검증 로직이 포함되었습니다.

Changes

파일/경로 변경 요약
.../dto/response/AnniversaryDetailResponse.kt 기념일 상세 응답 DTO 신설 및 Anniversary 엔티티 변환 팩토리 메서드 추가
.../facade/AnniversaryFacade.kt 인증 및 커플 ID 검증 후 기념일 상세 응답 반환 메서드(get) 추가
.../presentation/AnniversaryController.kt 기념일 상세 조회 GET API 엔드포인트 추가, Swagger 태그 수정

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Controller
    participant Facade
    participant Service

    User->>Controller: GET /anniversaries/{anniversaryId}
    Controller->>Facade: get(customUserDetails, anniversaryId)
    Facade->>Service: getById(anniversaryId)
    Service-->>Facade: Anniversary
    Facade->>Facade: 커플 ID 일치 여부 확인
    Facade-->>Controller: AnniversaryDetailResponse
    Controller-->>User: ApiResponse<AnniversaryDetailResponse>
Loading

Suggested reviewers

  • kimyeoungrok

Poem

🐰
기념일 상세, 토끼가 똑똑!
내 커플만 볼 수 있게 문단속
새로운 DTO, API도 척척
사랑의 날짜, 코드 속에 콕!

🎂💌


📜 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 ef3a45a and c481ef5.

📒 Files selected for processing (3)
  • src/main/kotlin/gomushin/backend/couple/dto/response/AnniversaryDetailResponse.kt (1 hunks)
  • src/main/kotlin/gomushin/backend/couple/facade/AnniversaryFacade.kt (2 hunks)
  • src/main/kotlin/gomushin/backend/couple/presentation/AnniversaryController.kt (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/kotlin/gomushin/backend/couple/facade/AnniversaryFacade.kt
  • src/main/kotlin/gomushin/backend/couple/dto/response/AnniversaryDetailResponse.kt
  • src/main/kotlin/gomushin/backend/couple/presentation/AnniversaryController.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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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 force-pushed the issue/#138-get-anniversary-detail branch from 6a990e0 to ef3a45a Compare May 25, 2025 16:21
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: 2

🧹 Nitpick comments (1)
src/main/kotlin/gomushin/backend/couple/domain/service/CoupleConnectService.kt (1)

19-21: 사용되지 않는 상수 제거 필요

COUPLE_CODE_DURATION 상수가 더 이상 사용되지 않으므로 제거해야 합니다.

다음과 같이 사용되지 않는 상수를 제거하세요:

-    companion object {
-        private val COUPLE_CODE_DURATION = Duration.ofMinutes(60)
-        private const val COUPLE_CODE_PREFIX = "COUPLE_CODE:"
-    }
+    companion object {
+        private const val COUPLE_CODE_PREFIX = "COUPLE_CODE:"
+    }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2f6f5d0 and ef3a45a.

📒 Files selected for processing (5)
  • .github/workflows/deploy.yml (1 hunks)
  • src/main/kotlin/gomushin/backend/couple/domain/service/CoupleConnectService.kt (1 hunks)
  • src/main/kotlin/gomushin/backend/couple/dto/response/AnniversaryDetailResponse.kt (1 hunks)
  • src/main/kotlin/gomushin/backend/couple/facade/AnniversaryFacade.kt (2 hunks)
  • src/main/kotlin/gomushin/backend/couple/presentation/AnniversaryController.kt (3 hunks)
🔇 Additional comments (5)
src/main/kotlin/gomushin/backend/couple/dto/response/AnniversaryDetailResponse.kt (1)

6-20: 잘 구현된 응답 DTO입니다.

코틀린 관례를 잘 따르고 있으며, 불변 속성과 팩토리 메서드를 적절히 사용했습니다. LocalDate 타입 사용도 적절합니다.

src/main/kotlin/gomushin/backend/couple/facade/AnniversaryFacade.kt (1)

37-43: 기념일 상세 조회 메서드가 잘 구현되었습니다.

권한 검증 로직이 적절히 구현되어 있고, 다른 메서드들과 일관된 패턴을 따르고 있습니다. 에러 처리도 명확합니다.

src/main/kotlin/gomushin/backend/couple/presentation/AnniversaryController.kt (3)

7-7: 새로운 DTO import 추가 승인

기념일 상세 조회 기능을 위한 AnniversaryDetailResponse import가 적절하게 추가되었습니다.


19-19: Tag 어노테이션 개선 승인

컨트롤러의 Tag를 "기념일 생성"에서 "기념일"로 변경한 것은 현재 컨트롤러가 생성뿐만 아니라 조회, 삭제 등 다양한 기념일 관련 기능을 제공하므로 더 적절한 변경입니다.


79-91: 기념일 상세 조회 엔드포인트 구현 승인

새로운 GET 엔드포인트가 잘 구현되었습니다:

  • REST API 규칙을 준수하여 GET 메서드 사용
  • 적절한 HTTP 상태 코드 (200 OK) 설정
  • 인증된 사용자 정보와 경로 변수를 올바르게 받음
  • 일관된 응답 형식 (ApiResponse 래핑) 사용
  • facade 패턴을 통한 비즈니스 로직 위임

다른 메서드들과 동일한 패턴을 따르고 있어 코드 일관성이 유지되고 있습니다.

Comment on lines 6 to 7
pull_request:
branches: [ main ]
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

배포 워크플로우가 PR에서도 트리거되는지 확인 필요

현재 설정으로는 main 브랜치로의 PR이 생성될 때마다 배포가 실행됩니다. 이는 의도된 동작인지 확인이 필요합니다. 일반적으로는 PR에서는 테스트만 실행하고, main 브랜치로 머지될 때만 배포하는 것이 좋습니다.

다음 스크립트로 다른 프로젝트의 워크플로우 패턴을 확인해보세요:


🏁 Script executed:

#!/bin/bash
# Description: Check if other workflow files separate CI and deployment
# Expected: Find patterns where CI runs on PR and deployment only on push to main

fd -e yml -e yaml . .github/workflows/ --exec grep -l "pull_request\|push" {} \; | head -5

Length of output: 124


배포 워크플로우 PR 트리거 제거 필요

현재 .github/workflows/deploy.yml 에서 pull_request 이벤트가 설정되어 있어, main 브랜치로 PR이 생성될 때마다 배포가 실행됩니다. PR 단계에서는 테스트만 수행하고, main 브랜치로 머지된 경우에만 배포하도록 수정이 필요합니다.

  • 수정 위치: .github/workflows/deploy.yml (lines 6–7)
  • 제안 변경:
-on:
-  pull_request:
-    branches: [ main ]
+on:
+  push:
+    branches: [ main ]

※ CI와 배포를 완전히 분리하려면 별도의 .github/workflows/ci.yml 파일을 만들어 PR 트리거로 테스트만 실행하고, deploy.yml 은 위와 같이 push 트리거만 사용하도록 구성하세요.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pull_request:
branches: [ main ]
on:
push:
branches: [ main ]
🤖 Prompt for AI Agents
In .github/workflows/deploy.yml around lines 6 to 7, the deployment workflow is
currently triggered on pull_request events to the main branch, causing
deployments on PR creation. To fix this, remove the pull_request trigger and
configure the workflow to trigger only on push events to the main branch. This
ensures deployments occur only after merging to main. Additionally, consider
creating a separate CI workflow file triggered on pull_request for running
tests.

val coupleCode = CoupleCodeGeneratorUtil.generateCoupleCode()
val key = getCoupleCodeKey(coupleCode)
redisTemplate.opsForValue().set(key, userId.toString(), COUPLE_CODE_DURATION)
redisTemplate.opsForValue().set(key, userId.toString())
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

커플 코드의 무제한 저장으로 인한 잠재적 문제

커플 코드에 만료 시간을 설정하지 않으면 다음과 같은 문제가 발생할 수 있습니다:

  1. Redis 메모리 사용량이 계속 증가
  2. 오래된 커플 코드가 무기한 사용 가능
  3. 보안상 위험 (코드 유출 시 영구적으로 유효)

만료 시간을 다시 설정하거나 다른 정리 메커니즘을 구현하는 것을 권장합니다:

-        redisTemplate.opsForValue().set(key, userId.toString())
+        redisTemplate.opsForValue().set(key, userId.toString(), COUPLE_CODE_DURATION)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
redisTemplate.opsForValue().set(key, userId.toString())
redisTemplate.opsForValue().set(key, userId.toString(), COUPLE_CODE_DURATION)
🤖 Prompt for AI Agents
In
src/main/kotlin/gomushin/backend/couple/domain/service/CoupleConnectService.kt
at line 27, the Redis set operation for the couple code does not specify an
expiration time, which can cause memory bloat and security risks. Modify the
code to set an appropriate expiration time on the Redis key when storing the
couple code, using RedisTemplate's set method overload that accepts a timeout
parameter or by explicitly setting the expiration after the set operation.

@HoyeongJeon HoyeongJeon force-pushed the issue/#138-get-anniversary-detail branch from ef3a45a to c481ef5 Compare May 25, 2025 17:00
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.

good

@HoyeongJeon HoyeongJeon merged commit 1ddd9fc into main May 26, 2025
1 check passed
@HoyeongJeon HoyeongJeon deleted the issue/#138-get-anniversary-detail branch May 26, 2025 02:05
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