Skip to content

[feat] 대화방 제목 지정/수정 API - #54

Merged
theminjunchoi merged 4 commits into
devfrom
feat/53-conversation-title
Jul 27, 2026
Merged

[feat] 대화방 제목 지정/수정 API#54
theminjunchoi merged 4 commits into
devfrom
feat/53-conversation-title

Conversation

@theminjunchoi

@theminjunchoi theminjunchoi commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

🔗 연관 이슈

📌 개요

대화방에 제목을 둔다. 첫 생성 시에는 제목이 없고(null), 이후 클라이언트가 전용 API로 지정한다. 제목은 여러 번 수정할 수 있다. (카드 요약과는 무관한 독립 필드)

🔧 주요 변경사항

  • Conversationnullable title 추가 — 새 대화방은 title = null
  • 제목은 규칙(공백 트림·1~100자) 있는 원시값이라 값 객체 ConversationTitle(Nickname 패턴)로 감쌈
  • 도메인 메서드 Conversation.rename() — 여러 번 호출 가능, 삭제된 방은 차단(ensureNotDeleted)
  • 전용 API: PATCH /api/conversations/{conversationId}/title (본인 대화방만)
  • ConversationResponsetitle 포함
  • ErrorCode.INVALID_CONVERSATION_TITLE 추가

🌐 API · DB 영향

  • API 변경: 추가PATCH /api/conversations/{conversationId}/title (body: { title })
  • DB 마이그레이션: V9conversations.title VARCHAR(100) NULL
  • 하위 호환: 호환 (신규 필드·엔드포인트만 추가)

💬 리뷰 포인트

  • 제목을 값 객체로 감싸 불변식(공백 트림·최대 길이)을 도메인이 보장 — 카드 요약과 무관한 독립 개념
  • 제목 수정은 상태 변경이 아니라 잠금 없이 getOwnedConversation 사용(삭제 가드는 rename이 처리)
  • 테스트: 값 객체 5건 + 통합(생성 시 null·지정·재수정·100자 초과·소유권·삭제 방 차단)

⚠️ V9 번호 주의

미머지 브랜치(대화방 검색·대시보드)도 V9를 씀 — 둘 중 하나 머지되면 나머지 renumber 필요.

Summary by CodeRabbit

  • 새로운 기능

    • 채팅방 제목을 지정하고 수정할 수 있습니다.
    • 제목은 최대 100자까지 지원하며, 앞뒤 공백은 자동으로 정리됩니다.
    • 새 채팅방은 제목 없이 생성될 수 있습니다.
    • 다른 사용자의 채팅방이나 삭제된 채팅방 제목은 수정할 수 없습니다.
  • 버그 수정

    • 유효하지 않은 제목 입력 시 명확한 오류 응답을 제공합니다.

- Conversation에 nullable title(ConversationTitle 값 객체, 공백트림·최대100자)
- PATCH /api/conversations/{id}/title — 본인 대화방, 여러 번 수정 가능, 삭제된 방 차단
- 새 대화방은 title=null, ConversationResponse에 title 포함
- V9 마이그레이션(conversations.title)
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Test Results

291 tests  +12   291 ✅ +12   1m 33s ⏱️ +10s
 46 suites + 1     0 💤 ± 0 
 46 files   + 1     0 ❌ ± 0 

Results for commit deb5c42. ± Comparison against base commit 7518b4b.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Test Coverage

Overall Project 74.46% -0.23% 🍏
Files changed 83.1% 🍏

File Coverage
ConversationResponse.kt 100% 🍏
UpdateConversationTitleRequest.kt 100% 🍏
ErrorCode.kt 100% 🍏
Conversation.kt 97.48% 🍏
ConversationService.kt 96.96% 🍏
ConversationTitle.kt 65.71% -34.29% 🍏
ConversationController.kt 63% 🍏

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@theminjunchoi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 819924d3-70a1-4938-aaca-be8ce70c0b19

📥 Commits

Reviewing files that changed from the base of the PR and between 821ec2f and deb5c42.

📒 Files selected for processing (4)
  • src/main/kotlin/com/nexters/gamss/conversation/controller/dto/UpdateConversationTitleRequest.kt
  • src/main/kotlin/com/nexters/gamss/conversation/service/ConversationService.kt
  • src/main/resources/db/migration/V11__conversation_title.sql
  • src/test/kotlin/com/nexters/gamss/conversation/controller/ConversationControllerIntegrationTest.kt

Walkthrough

대화방에 nullable 제목 필드와 ConversationTitle 값 객체를 추가하고, 소유자가 제목을 지정·수정할 수 있는 PATCH API와 데이터베이스 마이그레이션을 구현했습니다. 제목 검증, 소유권·삭제 상태 처리, 응답 및 통합 테스트도 추가했습니다.

Changes

대화방 제목 기능

Layer / File(s) Summary
제목 도메인 및 저장 구조
src/main/kotlin/com/nexters/gamss/conversation/domain/*, src/main/kotlin/com/nexters/gamss/global/exception/ErrorCode.kt, src/main/resources/db/migration/V9__conversation_title.sql
ConversationTitle이 입력을 trim하고 빈 값 및 100자 초과를 검증합니다. Conversation은 nullable 제목을 저장하고 삭제되지 않은 경우에만 변경하며, conversations.title 컬럼이 추가됩니다.
제목 수정 서비스 및 API
src/main/kotlin/com/nexters/gamss/conversation/service/ConversationService.kt, src/main/kotlin/com/nexters/gamss/conversation/controller/*
소유 대화방을 대상으로 제목을 지정·수정하는 트랜잭션 서비스와 PATCH /api/conversations/{conversationId}/title 엔드포인트를 추가했습니다. 응답의 제목은 nullable로 매핑됩니다.
제목 기능 검증 테스트
src/test/kotlin/com/nexters/gamss/conversation/domain/ConversationTitleTest.kt, src/test/kotlin/com/nexters/gamss/conversation/controller/ConversationControllerIntegrationTest.kt
초기 null, 제목 지정 및 재수정, 길이 초과, 타인 대화방, 삭제된 대화방에 대한 동작을 검증합니다.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ConversationController
  participant ConversationService
  participant Conversation
  Client->>ConversationController: PATCH /api/conversations/{conversationId}/title
  ConversationController->>ConversationService: updateTitle(memberId, conversationId, title)
  ConversationService->>Conversation: rename(ConversationTitle(title))
  Conversation-->>ConversationService: updated conversation
  ConversationService-->>ConversationController: Conversation
  ConversationController-->>Client: ApiResponse<ConversationResponse>
Loading

Possibly related PRs

  • Nexters/GAMSS-Server#44: ensureNotDeleted()CONVERSATION_ALREADY_DELETED 흐름이 삭제된 대화방 제목 수정 차단과 연결됩니다.

Suggested reviewers: kite707

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 대화방 제목 지정·수정 API 추가라는 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed 연관 이슈, 개요, 주요 변경사항, API·DB 영향, 리뷰 포인트가 모두 있어 템플릿 요구를 대부분 충족합니다.
Linked Issues check ✅ Passed #53의 요구사항인 nullable title, PATCH API, 소유권 검증, 삭제 방 차단, 응답 반영, 테스트와 DB 마이그레이션이 반영됐습니다.
Out of Scope Changes check ✅ Passed 요구된 대화방 제목 기능과 테스트·마이그레이션 범위를 벗어난 변경은 보이지 않습니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/53-conversation-title

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.

@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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/kotlin/com/nexters/gamss/conversation/controller/dto/UpdateConversationTitleRequest.kt`:
- Around line 7-9: Update UpdateConversationTitleRequest validation so blank or
whitespace-only titles are handled by ConversationTitle and return
INVALID_CONVERSATION_TITLE instead of being intercepted as INVALID_INPUT; remove
or adjust the conflicting NotBlank validation or align its
MethodArgumentNotValidException mapping. Add integration coverage for
whitespace-only and overlength titles to verify both cases use the contracted
error code.

In
`@src/main/kotlin/com/nexters/gamss/conversation/service/ConversationService.kt`:
- Around line 71-81: Update updateTitle to load the conversation through
getOwnedConversationForUpdate instead of getOwnedConversation, preserving the
existing ownership validation and rename flow so title changes use the same
row-level lock as deletion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0b70411f-27eb-44da-81e6-25cd10b58b7b

📥 Commits

Reviewing files that changed from the base of the PR and between e8b9f67 and 821ec2f.

📒 Files selected for processing (10)
  • src/main/kotlin/com/nexters/gamss/conversation/controller/ConversationController.kt
  • src/main/kotlin/com/nexters/gamss/conversation/controller/dto/ConversationResponse.kt
  • src/main/kotlin/com/nexters/gamss/conversation/controller/dto/UpdateConversationTitleRequest.kt
  • src/main/kotlin/com/nexters/gamss/conversation/domain/Conversation.kt
  • src/main/kotlin/com/nexters/gamss/conversation/domain/ConversationTitle.kt
  • src/main/kotlin/com/nexters/gamss/conversation/service/ConversationService.kt
  • src/main/kotlin/com/nexters/gamss/global/exception/ErrorCode.kt
  • src/main/resources/db/migration/V9__conversation_title.sql
  • src/test/kotlin/com/nexters/gamss/conversation/controller/ConversationControllerIntegrationTest.kt
  • src/test/kotlin/com/nexters/gamss/conversation/domain/ConversationTitleTest.kt

Comment thread src/main/kotlin/com/nexters/gamss/conversation/service/ConversationService.kt Outdated
- updateTitle이 getOwnedConversationForUpdate(행 잠금) 사용 — 잠금 없이 stale
  상태로 읽으면 동시 삭제가 flush로 되살아나는(모든 컬럼 UPDATE) 문제 방지
- UpdateConversationTitleRequest의 @notblank 제거 — 공백 검증을 ConversationTitle
  값 객체로 일원화(공백→INVALID_CONVERSATION_TITLE, 누락→INVALID_INPUT, 문서와 일치)
- 공백 제목 HTTP 케이스 테스트 추가
@theminjunchoi
theminjunchoi requested a review from kite707 July 27, 2026 12:59
@kite707

kite707 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

대화방 제목 컬럼이 생기면서, 최초에 첫 메시지에 대해 대화방 생성을 할 때 클라이언트측에서 제목도 같이 전달해주는 흐름이 자연스럽다고 생각하는데 어떻게 생각하시나요?

-> 클라와 논의된 사안인 것 확인했습니다!

@kite707 kite707 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

작업하느라 고생 많으셨습니다!!

dev에 generation_log(V9)·인덱스(V10)가 머지되어 V9가 겹치므로 다음 번호(V11)로 조정
@theminjunchoi
theminjunchoi merged commit c0644c9 into dev Jul 27, 2026
4 checks passed
@theminjunchoi
theminjunchoi deleted the feat/53-conversation-title branch July 27, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 대화방 제목 지정/수정 API

2 participants