Skip to content

Conversation

@dahyun24
Copy link
Contributor

@dahyun24 dahyun24 commented Nov 1, 2025

🔗 연관된 이슈

🚀 변경 유형

  • ✨ 기능 추가 (feature)
  • 🐛 버그 수정 (fix)
  • 📝 문서 변경 (docs)
  • ♻️ 리팩토링 (refactor)
  • 🧪 테스트 추가 / 수정 (test)
  • ⚙️ 설정 변경 (chore)

📝 작업 내용

  • isExpired 필드로 만료 여부 구분
  • 앨범 상세페이지 내 참여자 조회 구현
  • 만료된 앨범 참여자 조회 구현

📸 스크린샷

스크린샷 2025-11-01 오후 3 44 41

💬 리뷰 요구사항

Summary by CodeRabbit

  • New Features

    • 앨범 참여자 조회 API 추가: 참여자 목록(이름, 프로필, 역할, 내 여부)과 앨범 상세(만료 여부, 참가수, 행사일 등)을 제공합니다.
    • 참여자 목록 정렬 개선: 현재 사용자 우선 표시 및 메이커(제작자) 우선순위 반영.
  • Documentation

    • API 문서 및 응답 스펙 갱신(메이커 표기 반영, 새 응답 구조 안내).
  • Chores

    • 참여자 조회 성능 최적화 및 관련 성공 코드 추가.

@coderabbitai
Copy link

coderabbitai bot commented Nov 1, 2025

Walkthrough

앨범 참여자 조회 API와 관련 DTO/매퍼/컨트롤러/Swagger 및 리포지토리 쿼리 변경을 추가하고, 서비스에 참여자 조회·검증·정렬 로직을 구현했습니다.

Changes

Cohort / File(s) 변경 요약
서비스 레이어
src/main/java/com/cheeeese/album/application/AlbumService.java
getAlbumParticipantList(User currentUser, String code)buildSortedParticipantInfos(List<UserAlbum>, User currentUser) 추가 — 앨범/참여자 조회, 현재 사용자 검증, 만료 판정, 역할 매핑 및 정렬(내가 상단, Maker 우선, 이름 순)
응답 DTO
src/main/java/com/cheeeese/album/dto/response/AlbumParticipantListResponse.java, src/main/java/com/cheeeese/album/dto/response/AlbumParticipantResponse.java, src/main/java/com/cheeeese/album/dto/response/AlbumInvitationResponse.java
참여자 목록용 AlbumParticipantListResponse(내부 ParticipantInfo) 및 전체 응답 AlbumParticipantResponse 레코드 추가; AlbumInvitationResponsehost* 필드명이 maker*로 변경(설명 갱신 포함)
매퍼
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java, src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java
toParticipantInfo(User, Role, boolean)toAlbumParticipantResponse(Album, boolean, Role, List<ParticipantInfo>) 추가; Invitation 매핑에서 host→maker 필드로 매핑 변경
프레젠테이션 / Swagger
src/main/java/com/cheeeese/album/presentation/AlbumController.java, src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java
GET /v1/album/{code}/participants 엔드포인트·컨트롤러 메서드 및 Swagger 인터페이스 메서드 추가; 일부 response DTO import 정리(wildcard)
리포지토리
src/main/java/com/cheeeese/album/infrastructure/persistence/UserAlbumRepository.java
findAllByAlbumId JPQL에 JOIN FETCH ua.user 추가(연관 사용자 즉시 로드)
공통 코드
src/main/java/com/cheeeese/global/common/code/SuccessCode.java
ALBUM_PARTICIPANT_FETCH_SUCCESS 성공 코드 상수 추가

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client
    participant Controller as AlbumController
    participant Service as AlbumService
    participant Repo as UserAlbumRepository / AlbumRepository
    participant Mapper as UserAlbumMapper

    Client->>Controller: GET /v1/album/{code}/participants
    Controller->>Service: getAlbumParticipantList(currentUser, code)
    Service->>Repo: find album by code / findAllByAlbumId(albumId) (JOIN FETCH user)
    Repo-->>Service: Album, List<UserAlbum> (user 포함)
    Service->>Service: 참여 여부 검증, 만료 판정, 역할 매핑
    Service->>Service: buildSortedParticipantInfos(userAlbums, currentUser)
    loop 매핑
        Service->>Mapper: toParticipantInfo(user, role, isMe)
        Mapper-->>Service: ParticipantInfo
    end
    Service->>Mapper: toAlbumParticipantResponse(album, isExpired, myRole, participants)
    Mapper-->>Service: AlbumParticipantResponse
    Service-->>Controller: AlbumParticipantResponse
    Controller-->>Client: CommonResponse<AlbumParticipantResponse> (ALBUM_PARTICIPANT_FETCH_SUCCESS)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • 주의할 파일/부분:
    • buildSortedParticipantInfos()의 정렬 우선순위 및 동등 비교 처리
    • 서비스의 참여자 존재·권한 검증 및 만료 판단 로직
    • 리포지토리의 JOIN FETCH 변경으로 인한 쿼리 동작 및 N+1 영향
    • DTO/매퍼의 null 가능성 및 host→maker 필드명 일관성

Possibly related issues

Possibly related PRs

Suggested reviewers

  • zyovn

Poem

🐰 새 알림 왔네, 참여자들 모아
이름·역할·나를 앞세워 줄 세워
매퍼로 다듬고 서비스로 묶어
엔드포인트로 전해진 기쁨 한 줌
당근처럼 달콤한 응답이 왔네 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed PR 제목 "feat: 앨범 참여자 조회 로직 구현"은 changeset의 핵심 목적을 명확하게 요약하고 있습니다. 원본 요약에서 보듯이 주요 변경사항은 AlbumService에 getAlbumParticipantList 메서드 추가, 새로운 DTO 클래스들 정의, AlbumController에 GET /v1/album/{code}/participants 엔드포인트 추가, 참여자 정렬 로직 구현 등 모두 앨범 참여자 조회 기능 구현을 중심으로 이루어져 있습니다. 제목은 구체적이고 의미 있는 정보를 전달하며, 팀원이 PR 히스토리를 스캔할 때 주요 변경 사항을 즉시 파악할 수 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#37-album-participants

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30336a9 and 6c43641.

📒 Files selected for processing (1)
  • src/main/java/com/cheeeese/album/application/AlbumService.java (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/cheeeese/album/application/AlbumService.java (2)
src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (1)
  • AlbumMapper (13-149)
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
  • UserAlbumMapper (12-50)

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.

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: 4

🧹 Nitpick comments (2)
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)

32-48: participants 리스트 불변 처리 제안

participants 리스트가 외부에서 그대로 전달되면 이후 변경에 의해 응답 내용이 의도치 않게 바뀔 수 있습니다. 복사본을 만들어 넣으면 DTO 불변성이 보장되어 더 안전합니다.

-                .participants(participants)
+                .participants(List.copyOf(participants))
src/main/java/com/cheeeese/album/presentation/AlbumController.java (1)

5-5: 와일드카드 import 대신 명시적 import 사용을 고려하세요.

가독성과 명확성을 위해 와일드카드 import(.*) 대신 사용하는 클래스들을 명시적으로 import하는 것이 권장됩니다.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae96ac5 and de697ae.

📒 Files selected for processing (7)
  • src/main/java/com/cheeeese/album/application/AlbumService.java (3 hunks)
  • src/main/java/com/cheeeese/album/dto/response/AlbumParticipantListResponse.java (1 hunks)
  • src/main/java/com/cheeeese/album/dto/response/AlbumParticipantResponse.java (1 hunks)
  • src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (2 hunks)
  • src/main/java/com/cheeeese/album/presentation/AlbumController.java (2 hunks)
  • src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java (2 hunks)
  • src/main/java/com/cheeeese/global/common/code/SuccessCode.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/cheeeese/album/application/AlbumService.java (1)
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
  • UserAlbumMapper (12-50)
🔇 Additional comments (4)
src/main/java/com/cheeeese/album/dto/response/AlbumParticipantListResponse.java (1)

9-29: DTO 구조 정의 잘 되어 있습니다

필수 필드와 스키마 메타데이터 구성이 명확해 응답 형태 이해가 수월합니다.

src/main/java/com/cheeeese/album/dto/response/AlbumParticipantResponse.java (1)

11-41: 참여자 응답 필드 구성 👍

앨범 메타 정보와 참여자 목록을 한 번에 전달하도록 잘 정리되어 있어 클라이언트 측 활용이 용이해 보입니다.

src/main/java/com/cheeeese/global/common/code/SuccessCode.java (1)

27-27: 성공 코드 확장 적절합니다

새 엔드포인트와 메시지가 자연스럽게 매핑되어 일관된 응답 체계를 유지할 수 있겠습니다.

src/main/java/com/cheeeese/album/presentation/AlbumController.java (1)

61-71: 구현이 올바릅니다!

새로운 엔드포인트가 프로젝트의 컨트롤러 패턴을 잘 따르고 있으며, 적절한 서비스 계층 위임과 응답 래핑이 구현되어 있습니다.

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: 0

🧹 Nitpick comments (1)
src/main/java/com/cheeeese/album/application/AlbumService.java (1)

32-34: 사용하지 않는 import 제거가 필요합니다.

Line 34의 Map import가 코드에서 사용되지 않습니다. 이전 리뷰에서 roleMap을 제거하면서 더 이상 필요하지 않게 되었습니다.

다음과 같이 수정하세요:

 import java.util.Comparator;
 import java.util.List;
-import java.util.Map;
 import java.util.Optional;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de697ae and 2339f39.

📒 Files selected for processing (3)
  • src/main/java/com/cheeeese/album/application/AlbumService.java (3 hunks)
  • src/main/java/com/cheeeese/album/infrastructure/persistence/UserAlbumRepository.java (1 hunks)
  • src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/cheeeese/album/application/AlbumService.java (1)
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
  • UserAlbumMapper (12-50)
🔇 Additional comments (4)
src/main/java/com/cheeeese/album/infrastructure/persistence/UserAlbumRepository.java (1)

16-17: N+1 쿼리 문제가 올바르게 해결되었습니다!

JOIN FETCH를 사용하여 User 엔티티를 즉시 로딩하도록 수정하여, 이전 리뷰에서 지적된 N+1 쿼리 문제를 올바르게 해결했습니다.

src/main/java/com/cheeeese/album/application/AlbumService.java (2)

144-166: 참여자 조회 로직이 잘 구현되었습니다!

앨범 검증, 참여 여부 확인, 만료 상태 판단 등의 로직이 명확하게 구현되어 있습니다. 코드가 읽기 쉽고 각 단계의 책임이 명확히 분리되어 있습니다.


206-223: 이전 리뷰 제안이 올바르게 반영되었습니다!

UserAlbum에서 직접 role을 가져오도록 리팩토링되어, 불필요한 roleMap 생성 및 조회가 제거되었습니다. 정렬 로직도 명확합니다:

  1. 현재 사용자 우선 (isMe)
  2. MAKER 역할 우선
  3. 이름순 정렬

이전 리뷰에서 제안된 개선사항이 모두 반영되었습니다.

src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java (1)

220-256: API 문서가 잘 작성되었습니다!

새로운 참여자 조회 API에 대한 문서가 명확하고 포괄적입니다:

  • PathVariable 설명이 명확함
  • 만료된 앨범과 유효한 앨범의 응답 차이가 잘 설명됨
  • 적절한 응답 코드(200, 403) 정의
  • 에러 케이스에 대한 예시 제공

@zyovn zyovn added the ✨feature New feature or request label Nov 1, 2025
Copy link
Member

@zyovn zyovn left a comment

Choose a reason for hiding this comment

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

수고하셧습니다~🎸🦖

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: 1

🧹 Nitpick comments (1)
src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java (1)

4-4: 와일드카드 임포트 대신 명시적 임포트 고려

현재 와일드카드 임포트(import com.cheeeese.album.dto.response.*)를 사용하고 있습니다. 명시적으로 필요한 클래스만 임포트하면 코드 가독성과 의존성 파악이 더 쉬워집니다. 다만 여러 Response 클래스를 사용하는 경우 와일드카드 임포트도 합리적인 선택일 수 있습니다.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2339f39 and 30336a9.

📒 Files selected for processing (4)
  • src/main/java/com/cheeeese/album/application/AlbumService.java (4 hunks)
  • src/main/java/com/cheeeese/album/dto/response/AlbumInvitationResponse.java (1 hunks)
  • src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (2 hunks)
  • src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/cheeeese/album/application/AlbumService.java (2)
src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (1)
  • AlbumMapper (13-149)
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
  • UserAlbumMapper (12-50)
🔇 Additional comments (7)
src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java (1)

220-256: LGTM! 새로운 API 문서화가 잘 되어 있습니다.

앨범 참여자 조회 API의 Swagger 문서가 명확하고 상세하게 작성되었습니다. 응답 코드와 설명이 적절하며, PathVariable 및 로직 상세 설명도 포함되어 있습니다.

참고: 이전 리뷰에서 지적된 "evnetDate" 오타도 Line 229에서 "eventDate"로 수정된 것을 확인했습니다.

src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (2)

62-72: 일관된 호스트→메이커 용어 변경

toInvitationResponse 메서드의 파라미터명과 필드 매핑이 "호스트"에서 "메이커" 용어로 일관되게 변경되었습니다. DTO 변경사항과 정확히 일치합니다.


77-87: 만료된 앨범 응답도 일관되게 업데이트됨

만료된 앨범의 초대장 응답에서도 makerNamemakerProfileImage 필드명이 일관되게 사용되고 있습니다. 만료 시 해당 정보를 null로 설정하는 것도 합리적입니다.

src/main/java/com/cheeeese/album/dto/response/AlbumInvitationResponse.java (1)

23-27: DTO 필드명이 일관되게 변경되었습니다.

hostName/hostProfileImage에서 makerName/makerProfileImage로의 필드명 변경이 명확하고, 관련된 모든 매퍼와 서비스 코드에서도 일관되게 업데이트되었습니다.

src/main/java/com/cheeeese/album/application/AlbumService.java (3)

86-88: 용어 변경이 일관되게 적용되었습니다.

getMaker 메서드를 호출하여 maker 정보를 가져오고, 이를 AlbumMapper.toInvitationResponse에 전달하는 것이 명확하고 일관성 있습니다.


206-223: 이전 리뷰 제안이 잘 반영되었습니다.

buildSortedParticipantInfos 메서드가 이전 리뷰 코멘트의 제안대로 리팩토링되었습니다:

  • 불필요한 roleMap 생성이 제거됨
  • UserAlbum 객체에서 직접 userrole을 가져옴 (lines 212-213)
  • 정렬 로직이 명확함: 본인 → 메이커 → 이름순

코드가 더 간결하고 효율적으로 개선되었습니다.


144-166: 원본 리뷰 코멘트는 이미 해결된 사항입니다.

UserAlbumRepositoryfindAllByAlbumId 메서드를 확인한 결과, 다음과 같이 구현되어 있습니다:

@Query("SELECT ua FROM UserAlbum ua JOIN FETCH ua.user WHERE ua.album.id = :albumId")
List<UserAlbum> findAllByAlbumId(@Param("albumId") Long albumId);

JOIN FETCH가 이미 적용되어 있으므로 N+1 쿼리 문제는 해결되었습니다. 따라서 getAlbumParticipantList 메서드의 로직은 문제가 없으며, 추가 조치가 필요하지 않습니다.

@dahyun24 dahyun24 merged commit a211887 into develop Nov 2, 2025
1 check passed
@zyovn zyovn deleted the feat/#37-album-participants branch November 4, 2025 16:26
@coderabbitai coderabbitai bot mentioned this pull request Nov 15, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants