Skip to content

Feat: 카드셋 메타데이터 추가#5

Merged
stoneTiger0912 merged 1 commit intomainfrom
feat/add-metadata
Mar 16, 2026
Merged

Feat: 카드셋 메타데이터 추가#5
stoneTiger0912 merged 1 commit intomainfrom
feat/add-metadata

Conversation

@stoneTiger0912
Copy link
Member

@stoneTiger0912 stoneTiger0912 commented Mar 16, 2026

📝 변경 내용


✅ 체크리스트

  • 코드가 정상적으로 동작함
  • 테스트 코드 통과함
  • 문서(README 등)를 최신화함
  • 코드 스타일 가이드 준수

💬 기타 참고 사항

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 카드셋에 좋아요 및 북마크 수 표시 추가
    • 실시간 반응 추적 시스템 구현
  • API Changes

    • 카드셋 조회 응답에 likeCountbookmarkCount 필드 추가

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Caution

Review failed

Pull request was closed or merged during review

🐰 변경사항 분석

Walkthrough

카드셋 메타데이터 저장소 구조를 도입하여 좋아요와 북마크 카운트를 추적합니다. RabbitMQ 소비자를 구현하여 반응 이벤트를 처리하고 메타데이터를 업데이트합니다. API 응답에 카운트 필드를 추가합니다.

Changes

코호트 / 파일(들) 요약
의존성 및 기본 설정
package.json, src/main.ts
RabbitMQ 라이브러리 추가 및 Swagger 글로벌 X-USER-ID 헤더 매개변수 추가.
도메인 및 인프라 기초
src/cardset/domain/repository/cardset-metadata.repository.ts, src/cardset/infrastructure/persistence/orm/cardset-metadata.orm-entity.ts
메타데이터 레포지토리 인터페이스 및 ORM 엔티티 정의. 좋아요/북마크 카운트 조회 및 업서트 기능 제공.
레포지토리 구현
src/cardset/infrastructure/persistence/cardset-metadata.repository.impl.ts
TypeORM 기반 메타데이터 레포지토리 구현. SQL 쿼리를 통해 카운트 증감 처리.
모듈 통합
src/app.module.ts, src/cardset/cardset.module.ts, src/reaction/reaction.module.ts
반응 모듈 임포트, 메타데이터 엔티티 등록, RabbitMQ 설정 추가.
RabbitMQ 소비자
src/reaction/reaction.consumer.ts
RabbitMQ 이벤트 구독. 좋아요/북마크 이벤트를 처리하여 메타데이터 업데이트.
사용 사례 및 API 응답
src/cardset/application/cardset.use-case.ts, src/cardset/application/dto/response/cardset.response.ts
메타데이터 저장소 주입. 응답에 좋아요/북마크 카운트 필드 추가 및 채우기.
컨트롤러 업데이트
src/cardset/infrastructure/http/cardset.controller.ts, src/cardset/infrastructure/http/card.controller.ts
응답 생성 시 카운트 필드 전달. 중복된 Swagger ApiHeader 데코레이터 제거.

Sequence Diagram

sequenceDiagram
    participant RMQ as RabbitMQ
    participant RC as ReactionConsumer
    participant Repo as MetadataRepository
    participant DB as Database

    RMQ->>RC: 반응 이벤트 발행<br/>(LIKE_ADDED, BOOKMARK_ADDED 등)
    RC->>RC: 이벤트 검증<br/>(targetType=CARD_SET 확인)
    RC->>Repo: upsertAndIncrementLike()<br/>또는 기타 업서트 메서드 호출
    Repo->>DB: INSERT ... ON DUPLICATE KEY UPDATE<br/>또는 UPDATE with GREATEST
    DB-->>Repo: 행 업데이트 완료
    Repo-->>RC: void 반환
    RC->>RC: 로깅
Loading
sequenceDiagram
    participant Client
    participant Controller as CardsetController
    participant UseCase as CardsetUseCase
    participant Repo as MetadataRepository
    participant DB as Database

    Client->>Controller: GET /cardsets
    Controller->>UseCase: findAll(userId)
    UseCase->>Repo: findByCardSetIds(cardsetIds)
    Repo->>DB: SELECT * FROM card_set_metadata
    DB-->>Repo: 메타데이터 행들
    Repo-->>UseCase: Map<cardSetId, {likeCount, bookmarkCount}>
    UseCase->>UseCase: 각 카드셋에 카운트 어셈블
    UseCase-->>Controller: [{cardset, imageUrl, likeCount, bookmarkCount}]
    Controller->>Controller: CardsetResponse.from()<br/>모든 필드 포함
    Controller-->>Client: 응답 전송
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Feat: grpc 추가 #2: src/cardset/application/cardset.use-case.ts 및 반환 타입 변경에서 코드 수준의 연관성이 있습니다.

Poem

🐰 좋아요 세어주는 토끼 여행
RabbitMQ로 메시지 날리고
메타데이터 쏙쏙 저장하네 ✨
북마크도 척척 세어주고
카드셋이 인기척척! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목 '카드셋 메타데이터 추가'는 전체 변경사항의 핵심을 명확하게 요약합니다. 새로운 메타데이터 저장소, ORM 엔티티, RabbitMQ 컨슈머, 그리고 응답 DTO 확장 등 모든 주요 변경사항이 메타데이터 기능 추가와 직접적으로 관련되어 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-metadata
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@stoneTiger0912 stoneTiger0912 merged commit 3d93a42 into main Mar 16, 2026
1 of 2 checks passed
@stoneTiger0912 stoneTiger0912 deleted the feat/add-metadata branch March 16, 2026 02:27
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