Skip to content

refactor : 코드 품질 개선 및 버그 수정#80

Merged
Juhye0k merged 7 commits intodevfrom
sql
Sep 25, 2025
Merged

refactor : 코드 품질 개선 및 버그 수정#80
Juhye0k merged 7 commits intodevfrom
sql

Conversation

@Juhye0k
Copy link
Copy Markdown
Contributor

@Juhye0k Juhye0k commented Sep 25, 2025

What is this PR?🔍

코드 품질 개선을 위한 전반적인 리팩토링 작업과 무한 스크롤 정렬 버그 수정

Changes💻

  • 포인트 거래내역 데이터 일관성 처리 및 중복 메소드 제거
  • OneCall 메소드 분리 및 하드코딩된 상수를 final로 처리
  • 제네릭을 활용하여 반복 함수 단순화 (convertOrdersToResponse 메소드 추가)
  • 포인트 구매 로직 개선 (가격 검증 로직 추가, 메소드 호출 순서 조정)
  • 무한 스크롤 정렬 오류 수정 (ASC/DESC 조건 반전 문제 해결)

Summary by CodeRabbit

  • 신기능
    • 내 프로필 닉네임 수정 API 추가.
    • 내 지갑 조회 API 추가.
  • 성능
    • 날씨 데이터에 캐시를 도입해 응답 속도와 안정성 향상.
  • 버그 수정
    • 리뷰 목록의 커서 기반 페이징 조건을 보정해 올바른 정렬/다음 페이지 제공.
  • 리팩터링
    • 지갑 관련 응답 매핑 로직을 공통화하고 명칭·구조를 정리.
    • 주석 및 포맷 정돈으로 가독성 향상.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

여러 도메인에 걸친 변경이 포함됨. 지갑/포인트 트랜잭션 로직 재구성 및 엔드포인트 추가, 날씨 서비스에 Redis 캐시 도입과 데이터 변환 헬퍼 추가, 리뷰 페이징 커서 비교식 반전, 회원 프로필 수정 엔드포인트 추가와 리포지토리 메서드 제거, 아이템 구매 시 포인트 차감 위치 이동.

Changes

Cohort / File(s) Summary of changes
Wallet 트랜잭션/응답 리팩터링
src/main/java/avengers/lion/wallet/service/WalletService.java, src/main/java/avengers/lion/wallet/controller/WalletController.java
리뷰 보상 상수 추가, 공통 매퍼 convertOrdersToResponse 도입, getMyUsedItemsgetMyConsumedItems로 이름 변경, addPointTransaction/addPointTransactionForReview@Transactional 추가 및 포인트 차감 위치를 서비스 내부(member.buyItemByPoint(price))로 이동, 리뷰 보상에 상수 적용, 내 지갑 조회 API(GET /api/v1/wallet/my-wallet) 추가.
아이템 구매 흐름 조정
src/main/java/avengers/lion/item/service/ItemService.java
멤버 포인트 직접 차감 호출 제거, 가격 계산/재고 확인 주석 정비, 트랜잭션은 walletService.addPointTransaction(...)에서 처리.
회원 프로필/리포지토리
src/main/java/avengers/lion/member/controller/MemberController.java, src/main/java/avengers/lion/member/repository/MemberRepository.java, src/main/java/avengers/lion/member/service/MemberService.java
닉네임 변경 API(PUT /api/v1/members/my-profile) 추가, existsByEmail 삭제, 서비스에 프로필 업데이트 주석 추가(동작 동일).
리뷰 페이징/서비스 정리
src/main/java/avengers/lion/review/repository/ReviewQueryRepositoryImpl.java, src/main/java/avengers/lion/review/service/ReviewService.java
커서 페이징 비교식 반전(ASC 시 id.gt, DESC 시 id.lt), getWrittenDetailPage(...) 제거, 리뷰 작성 시 member.addPointByReview() 제거.
날씨 서비스 캐싱/맵핑
src/main/java/avengers/lion/weather/service/WeatherService.java
시간 단위 키와 TTL을 사용하는 Redis 캐시 도입, API exclude 파라미터 상수화, 에러 핸들링 보강, 데이터 변환 헬퍼(convertToCurrentWeather, convertToHourWeather) 추가 및 호출부 리팩터링.
사소한 포맷팅
src/main/java/avengers/lion/mission/controller/VerificationController.java
공백 라인 제거(동작 동일).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant IC as ItemController/Service
  participant WS as WalletService
  participant M as Member
  participant I as Item
  participant O as Order/Wallet

  U->>IC: 구매 요청(count, itemId)
  IC->>IC: 가격 계산(price)·재고 확인
  IC->>WS: addPointTransaction(price, member, itemCategory)
  WS->>M: buyItemByPoint(price)
  WS->>O: 포인트 트랜잭션 기록
  IC->>I: buyItem(count)
  IC-->>U: 구매 결과
Loading
sequenceDiagram
  autonumber
  participant C as Client
  participant W as WeatherService
  participant R as Redis Cache
  participant API as OpenWeather API

  C->>W: getWeather(lat, lon, now)
  W->>W: 시간 단위 캐시 키 생성
  W->>R: GET cache[key]
  alt 캐시 적중
    R-->>W: WeatherBasic
    W-->>C: 응답(캐시)
  else 캐시 미스
    W->>API: oneCall(lat, lon, exclude=API_EXCLUDE_PARAMS)
    API-->>W: OpenWeatherDto
    W->>W: convertToCurrentWeather / convertToHourWeather
    W->>R: SETEX cache[key], TTL
    W-->>C: 응답(신규)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

Possibly related PRs

Poem

새 지갑, 새 바람, 포인트 톡톡 춤추고,
구름엔 캐시, 시간 열쇠로 잠그고.
리뷰의 길 바뀌어 커서가 살금살금,
닉네임 살짝 손봐도 봄바람 스윽—
깡총! 코드밭에 달빛처럼 머문다. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sql

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1083934 and ec2a7df.

📒 Files selected for processing (10)
  • src/main/java/avengers/lion/item/service/ItemService.java (1 hunks)
  • src/main/java/avengers/lion/member/controller/MemberController.java (1 hunks)
  • src/main/java/avengers/lion/member/repository/MemberRepository.java (0 hunks)
  • src/main/java/avengers/lion/member/service/MemberService.java (1 hunks)
  • src/main/java/avengers/lion/mission/controller/VerificationController.java (0 hunks)
  • src/main/java/avengers/lion/review/repository/ReviewQueryRepositoryImpl.java (1 hunks)
  • src/main/java/avengers/lion/review/service/ReviewService.java (1 hunks)
  • src/main/java/avengers/lion/wallet/controller/WalletController.java (1 hunks)
  • src/main/java/avengers/lion/wallet/service/WalletService.java (4 hunks)
  • src/main/java/avengers/lion/weather/service/WeatherService.java (1 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Juhye0k Juhye0k merged commit 20e91cf into dev Sep 25, 2025
1 of 2 checks passed
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.

1 participant