Skip to content

[Feat] 여행 기록 공동 편집 및 수정 충돌 방지 구현 - #421

Merged
yeonie0309 merged 2 commits into
developfrom
feat/420-travel-record-coediting
Oct 31, 2026
Merged

yeonie0309 merged 2 commits into
developfrom
feat/420-travel-record-coediting

Conversation

@yeonie0309

@yeonie0309 yeonie0309 commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

📌 PR 설명

  • 현재 공유 앨범 참여자까지 여행 기록 수정 권한 확장
  • version 검증 및 사진·스티커 변경의 버전 증가, 충돌 시 409 반환
  • 다른 참여자의 기존 커스텀 스티커 유지·편집 처리
  • CodeRabbit 검토 보완: 이미지 이동 전 버전 확보 및 충돌 요청의 파일 이동 차단

🔗 연관된 이슈

Resolves: #420

📝 리뷰 요구사항

  • 현재 참여자만 수정 가능한지 확인 부탁드립니다.
  • 동시 수정 시 한 요청만 저장되고 실패한 요청의 변경은 롤백되는지 확인 부탁드립니다.
  • 수정 요청에는 상세 조회의 version이 필수이며, 응답에 저장 후 version을 반환합니다.

💻 테스트 결과

  • 전체 테스트 및 빌드 통과
  • 로컬 Swagger 정상, 검증, 권한, 충돌 응답 확인

참여자 수정 성공
clipboard

이전 버전 충돌
clipboard

공개 열람자의 수정 거부
clipboard

Summary by CodeRabbit

  • New Features
    • Owners can update travel records, and current participants can co-edit records shared with friends.
    • Update requests and responses now include a version, helping clients track the latest saved state.
  • Bug Fixes
    • Concurrent or outdated edits are rejected with a conflict response, preventing newer changes from being overwritten.
    • Failed updates no longer proceed to change photos or stickers.
  • Validation
    • Updates require a non-negative version, and albums are limited to five photos.

@yeonie0309 yeonie0309 self-assigned this Oct 31, 2026
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

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: e7bcc222-0080-4887-83be-f5a6e2b4c10e
Commits

Reviewing files that changed from the base of the PR and between c3589ea and dd7289e.

Files selected for processing: 10
  • src/main/java/com/yeogido/backend/domain/travel/controller/TravelRecordController.java
  • src/main/java/com/yeogido/backend/domain/travel/converter/TravelRecordConverter.java
  • src/main/java/com/yeogido/backend/domain/travel/dto/request/TravelRecordReqDTO.java
  • src/main/java/com/yeogido/backend/domain/travel/dto/response/TravelRecordResDTO.java
  • src/main/java/com/yeogido/backend/domain/travel/exception/TravelRecordErrorCode.java
  • src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordRepository.java
  • src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordServiceImpl.java
  • src/test/java/com/yeogido/backend/domain/travel/controller/TravelRecordVisibilityApiTest.java
  • src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordCoeditingTransactionTest.java
  • src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordVisibilityIntegrationTest.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.

Walkthrough

Travel-record updates now require a version and return the saved version. The service conditionally applies updates, authorizes owners and current FRIENDS participants, and enforces participant sticker rules.

Changes: Travel record co-editing

Layer / File(s) Summary
Update version contract
src/main/java/com/yeogido/backend/domain/travel/dto/request/TravelRecordReqDTO.java, src/main/java/com/yeogido/backend/domain/travel/dto/response/TravelRecordResDTO.java, src/main/java/com/yeogido/backend/domain/travel/exception/TravelRecordErrorCode.java, src/main/java/com/yeogido/backend/domain/travel/converter/TravelRecordConverter.java, src/main/java/com/yeogido/backend/domain/travel/controller/TravelRecordController.java, src/test/java/com/yeogido/backend/domain/travel/controller/TravelRecordVisibilityApiTest.java
Update requests require a non-negative version. Responses include the saved version, and stale versions have a 409 error code. The API description and tests cover request validation and the update payload.
Conditional versioned save
src/main/java/com/yeogido/backend/domain/travel/repository/TravelRecordRepository.java, src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordServiceImpl.java, src/test/java/com/yeogido/backend/domain/travel/controller/TravelRecordVisibilityApiTest.java, src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordCoeditingTransactionTest.java, src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordVisibilityIntegrationTest.java
The repository updates a record only when its ID and version match, then increments the version. Tests cover concurrent updates, stale versions, version increments, and failed sticker updates that leave record data unchanged.
Participant permissions and album edits
src/main/java/com/yeogido/backend/domain/travel/service/TravelRecordServiceImpl.java, src/test/java/com/yeogido/backend/domain/travel/controller/TravelRecordVisibilityApiTest.java, src/test/java/com/yeogido/backend/domain/travel/service/TravelRecordVisibilityIntegrationTest.java
Owners can edit records at any visibility. Current participants can edit FRIENDS records, subject to sticker placement rules. Tests cover denied access, sticker retention and removal, and the six-photo limit.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant TravelRecordController
  participant TravelRecordServiceImpl
  participant TravelRecordRepository
  participant Database
  Client->>TravelRecordController: Submit update with version
  TravelRecordController->>TravelRecordServiceImpl: Call updateTravelRecord
  TravelRecordServiceImpl->>TravelRecordRepository: Update fields where ID and version match
  TravelRecordRepository->>Database: Increment version and save matching record
  Database-->>TravelRecordRepository: Return affected row count
  TravelRecordRepository-->>TravelRecordServiceImpl: Return update result
  TravelRecordServiceImpl-->>TravelRecordController: Return saved record or version conflict
  TravelRecordController-->>Client: Return response with saved version or conflict
Loading

Suggested reviewers: yangjiae12

Merge Risk: Low · up to dd728

A simultaneous edit can leave uploaded images unavailable for retry, requiring another upload. This is a bounded merge risk that warrants owner awareness and follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… 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 identifies the main changes: collaborative travel-record editing and update-conflict prevention.
Linked Issues check Passed 이 PR은 활성 이슈 #420의 코딩 요구사항을 충족합니다. updateTravelRecord는 활성 사용자 중 PRIVATE·PUBLIC 앨범의 생성자와 FRIENDS 앨범의 현재 참여자만 허용합니다. 대기·거절·탈퇴 참여자와 비활성 사용자는 테스트로 거부합니다. 요청 version은 필수이며 0 이상으로 검증하고, 저장 후 버전을 응답합니다. 조…
Out of Scope Changes check Passed 변경은 이슈 #420의 공동 편집과 충돌 방지에 직접 연결됩니다. API 설명, 요청·응답 DTO, 오류 코드, 버전 조건부 저장, 권한·사진·스티커 처리와 관련 통합/API 테스트만 변경했습니다. 검토된 변경에서 unrelated 기능이나 독립된 제품 범위의 변경은 확인되지 않습니다.
Description check Passed The pull request description follows the required structure. It explains the changes, links issue #420, lists review requirements, and reports test and Swagger results with supporting screenshots.
Full details: Linked Issues check

Explanation

이 PR은 활성 이슈 #420의 코딩 요구사항을 충족합니다. updateTravelRecord는 활성 사용자 중 PRIVATE·PUBLIC 앨범의 생성자와 FRIENDS 앨범의 현재 참여자만 허용합니다. 대기·거절·탈퇴 참여자와 비활성 사용자는 테스트로 거부합니다. 요청 version은 필수이며 0 이상으로 검증하고, 저장 후 버전을 응답합니다. 조건부 버전 갱신은 사진·스티커만 변경하는 경우에도 버전을 증가시키며, 충돌에는 TRAVEL_RECORD4091과 409를 사용합니다. 사진 수 1~5장, 스티커 생략 유지와 빈 배열 삭제 정책, 타 참여자의 기존 커스텀 스티커 유지·편집 및 신규 무단 사용 차단을 통합 테스트가 검증합니다. 동시 갱신 승자 1건, 충돌 1건, 실패한 스티커 갱신의 메타데이터·사진 롤백도 테스트합니다.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.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 4 functions across 10 files.

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

@yangjiae12 yangjiae12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

확인했습니다! 수고하셨습니다~

추가로 이번 PR에서 새로 생긴 문제는 아니지만, 사진 이동 후 스티커 검증에 실패하면 임시 사진이 이미 삭제되어 재시도가 어려울 수 있어 보입니다. 스티커 검증을 사진 이동 전에 진행하는 부분은 별도 이슈로 후속 보완해주시면 좋겠습니다!

@yeonie0309

Copy link
Copy Markdown
Collaborator Author

확인했습니다! 수고하셨습니다~

추가로 이번 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.

[FEAT] 여행 기록 공동 편집 및 수정 충돌 방지 구현

2 participants