Skip to content

[Feat] 공유 앨범 초대 수락, 거절 API 구현 - #446

Open
yeonie0309 wants to merge 2 commits into
feat/442-travel-record-invitation-listfrom
feat/445-travel-record-invitation-response
Open

yeonie0309 wants to merge 2 commits into
feat/442-travel-record-invitation-listfrom
feat/445-travel-record-invitation-response

Conversation

@yeonie0309

@yeonie0309 yeonie0309 commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

📌 PR 설명

  • 본인이 받은 공유 앨범 초대에 응답하는 PATCH /api/v1/travel-records/invitations/{invitationId}를 추가했습니다. 수락하면 참여 관계를 생성하고, 거절하면 대기 폴더 목록에서 제외합니다.
  • 초대 상태 변경과 참여자 생성을 한 트랜잭션으로 처리하고, 수락으로 참여자가 추가되면 앨범 버전을 갱신합니다.
  • 같은 응답의 재요청은 성공으로 처리합니다. 반대 응답이나 나간 뒤 옛 수락 초대로 재가입하는 요청은 TRAVEL_RECORD4094를 반환합니다.
  • V43에서 대기 초대를 당시의 친구 관계에 연결했습니다. 친구 해제 시 대기 초대가 함께 삭제되며, 다시 친구가 되어도 복구되지 않습니다.

🔗 연관된 이슈

Resolves: #445

📝 리뷰 요구사항

  • 중복 수락과 수락, 거절의 동시 요청에서 참여자가 중복 생성되지 않는지 확인 부탁드립니다.
  • 친구 해제 시 대기 초대만 삭제되고, 수락 완료 후에는 기존 앨범 참여 관계가 유지되는지 확인 부탁드립니다.
  • #443에 의존하는 작업으로, 해당 PR 머지 후 base를 develop으로 변경합니다.

💻 테스트 결과

  • API 테스트 완료
  • 정상 동작 확인
수락 성공 거절 성공 이미 처리된 초대
수락 성공 거절 성공 이미 처리된 초대

Summary by CodeRabbit

  • New Features
    • Added the ability to accept or decline travel-record invitations.
    • Accepted invitations add the recipient as a travel-record member. Repeating the same response is supported when the recipient is already a member.
    • Invitation responses are checked against the recipient’s access and the current status of the travel record and friendship.
  • Bug Fixes
    • Invitation lists now exclude invitations where the related friendship or either participant is no longer active.

@yeonie0309 yeonie0309 self-assigned this Nov 3, 2026
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb0ab54c-0667-45ae-88b2-be80f06b41c4
Commits

Reviewing files that changed from the base of the PR and between 7c9deee and 8db037f.

Files selected for processing: 2
  • src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationServiceImpl.java
  • src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationResponseIntegrationTest.java
Walkthrough

The PR adds an API for recipients to accept or decline travel-record invitations. It links pending invitations to accepted friendships, applies validation and membership updates during responses, and updates the pending-invitation query.

Changes: Travel invitation lifecycle

Layer / File(s) Summary
Link invitations to friendships
src/main/java/com/yeogido/backend/domain/travel/entity/TravelRecordInvitation.java, src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationServiceImpl.java, src/main/resources/db/migration/V43__link_pending_travel_invitations_to_friendship.sql
Invitations now store an optional friendship association. The migration links eligible pending invitations to accepted friendships and removes pending invitations without a matching link. Invitation creation validates friendships in sorted invitee order and stores them with the invitations.
Respond to an invitation
src/main/java/com/yeogido/backend/domain/travel/controller/TravelRecordInvitationController.java, src/main/java/com/yeogido/backend/domain/travel/dto/request/TravelRecordInvitationReqDTO.java, src/main/java/com/yeogido/backend/domain/travel/dto/response/TravelRecordInvitationResDTO.java, src/main/java/com/yeogido/backend/domain/travel/converter/TravelRecordInvitationConverter.java, src/main/java/com/yeogido/backend/domain/travel/entity/TravelRecordInvitation.java, src/main/java/com/yeogido/backend/domain/travel/exception/TravelRecordErrorCode.java, src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordInvitationRepository.java, src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordMemberRepository.java, src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationService.java, src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationServiceImpl.java, src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationResponseIntegrationTest.java
A PATCH endpoint accepts validated ACCEPTED or DECLINED responses. The service checks invitation and user state, handles repeated responses, adds membership on acceptance, and reserves the travel-record version. Integration tests cover authorization, lifecycle, validation, and concurrent operations.
Filter pending invitations
src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordInvitationQueryRepositoryImpl.java, src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationListIntegrationTest.java
The pending-list query now requires an accepted friendship and active inviter. Test fixtures associate pending invitations with accepted friendships.

Estimated code review effort: 4 (Complex) | ~50 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Recipient
  participant TravelRecordInvitationController
  participant TravelRecordInvitationServiceImpl
  participant TravelRecordInvitationRepository
  participant TravelRecordMemberRepository
  Recipient->>TravelRecordInvitationController: PATCH invitation response
  TravelRecordInvitationController->>TravelRecordInvitationServiceImpl: respondToInvitation
  TravelRecordInvitationServiceImpl->>TravelRecordInvitationRepository: load invitation with write lock
  TravelRecordInvitationServiceImpl->>TravelRecordMemberRepository: check membership with write lock
  TravelRecordInvitationServiceImpl-->>TravelRecordInvitationController: return response
  TravelRecordInvitationController-->>Recipient: return OK response
Loading

Possibly related issues

  • yeogido/backend#436 — The PR changes how invitations behave after a response or after leaving, but does not implement invitation creation.
  • yeogido/backend#442 — The PR updates the pending-invitation query and changes whether responded invitations remain in its results.

Possibly related PRs

  • yeogido/backend#440 — Adds invitation creation and the invitation records that this PR accepts or declines.
  • yeogido/backend#443 — Adds the received-invitation list, which this PR updates through response status changes and query filters.
  • yeogido/backend#424 — Adds accepted friendship behavior used by this PR’s invitation creation and response checks.

Suggested reviewers: yangjiae12, chans20

Merge Risk: Low · previous review 7c9de

A narrow concurrency window can allow an invitation response after a user is deactivated. Use current status reads before merging, or accept this bounded risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: implementing APIs to accept or decline shared album invitations.
Description check Passed The description includes the requested change, linked issue, review focus, dependency note, test results, and API test evidence. It matches the required template and provides sufficient implementation…
Linked Issues check Passed 직접 연결된 활성 이슈 #445의 코딩 요구사항을 충족합니다. PATCH /api/v1/travel-records/invitations/{invitationId}와 수신자·상태 검증을 구현했습니다. respondToInvitation은 트랜잭션에서 앨범, 친구 관계, 초대를 잠그고 수락 시 참여 관계와 버전을 함께 변경합니다. 동일 응답, 반대 응답…
Out of Scope Changes check Passed 변경 범위는 #445와 연결됩니다. 컨트롤러, DTO, 변환기, 서비스, 저장소, 엔티티 변경은 초대 응답 API와 동시성 처리를 지원합니다. 초대 생성 시 친구 관계를 저장하고 대기 초대 조회를 제한하는 변경은 친구 해제 시 대기 초대 삭제 및 복구 방지 요구사항을 구현합니다. V43 마이그레이션과 통합 테스트도 해당 기능의 지원 변경입니다. 확인된 un…
Full details: Description check

Explanation

The description includes the requested change, linked issue, review focus, dependency note, test results, and API test evidence. It matches the required template and provides sufficient implementation context.

Full details: Linked Issues check

Explanation

직접 연결된 활성 이슈 #445의 코딩 요구사항을 충족합니다. PATCH /api/v1/travel-records/invitations/{invitationId}와 수신자·상태 검증을 구현했습니다. respondToInvitation은 트랜잭션에서 앨범, 친구 관계, 초대를 잠그고 수락 시 참여 관계와 버전을 함께 변경합니다. 동일 응답, 반대 응답, 나간 뒤 재가입 시도를 처리합니다. V43 마이그레이션은 대기 초대를 친구 관계에 연결하고 ON DELETE CASCADE를 적용합니다. 통합 테스트는 중복 수락, 수락·거절 경합, 앨범 삭제·나가기 경합, 친구 해제, 재친구 관계, 인증 및 입력 검증을 검증합니다. Swagger 확인과 #443 병합 후 base 변경은 수동 또는 관리 작업이므로 코딩 요구사항으로 평가하지 않습니다.

Full details: Out of Scope Changes check

Explanation

변경 범위는 #445와 연결됩니다. 컨트롤러, DTO, 변환기, 서비스, 저장소, 엔티티 변경은 초대 응답 API와 동시성 처리를 지원합니다. 초대 생성 시 친구 관계를 저장하고 대기 초대 조회를 제한하는 변경은 친구 해제 시 대기 초대 삭제 및 복구 방지 요구사항을 구현합니다. V43 마이그레이션과 통합 테스트도 해당 기능의 지원 변경입니다. 확인된 unrelated 변경은 없습니다.

Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 10 functions across 13 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e4c404eb-364a-4d47-a1af-652d1586b405
Commits

Reviewing files that changed from the base of the PR and between e2c511a and 7c9deee.

Files selected for processing: 14
  • src/main/java/com/yeogido/backend/domain/travel/controller/TravelRecordInvitationController.java
  • src/main/java/com/yeogido/backend/domain/travel/converter/TravelRecordInvitationConverter.java
  • src/main/java/com/yeogido/backend/domain/travel/dto/request/TravelRecordInvitationReqDTO.java
  • src/main/java/com/yeogido/backend/domain/travel/dto/response/TravelRecordInvitationResDTO.java
  • src/main/java/com/yeogido/backend/domain/travel/entity/TravelRecordInvitation.java
  • src/main/java/com/yeogido/backend/domain/travel/exception/TravelRecordErrorCode.java
  • src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordInvitationQueryRepositoryImpl.java
  • src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordInvitationRepository.java
  • src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordMemberRepository.java
  • src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationService.java
  • src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationServiceImpl.java
  • src/main/resources/db/migration/V43__link_pending_travel_invitations_to_friendship.sql
  • src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationListIntegrationTest.java
  • src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordInvitationResponseIntegrationTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

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