Skip to content

[hotfix] response 필드 네이밍 통일#201

Merged
seongjunnoh merged 2 commits intodevelopfrom
hotfix/#200-alias-related-response-naming
Aug 12, 2025
Merged

[hotfix] response 필드 네이밍 통일#201
seongjunnoh merged 2 commits intodevelopfrom
hotfix/#200-alias-related-response-naming

Conversation

@seongjunnoh
Copy link
Collaborator

@seongjunnoh seongjunnoh commented Aug 12, 2025

#️⃣ 연관된 이슈

closes #200

📝 작업 내용

이슈 참고해주시면 됩니다

📸 스크린샷

💬 리뷰 요구사항

📌 PR 진행 시 이러한 점들을 참고해 주세요

* P1 : 꼭 반영해 주세요 (Request Changes) - 이슈가 발생하거나 취약점이 발견되는 케이스 등
* P2 : 반영을 적극적으로 고려해 주시면 좋을 것 같아요 (Comment)
* P3 : 이런 방법도 있을 것 같아요~ 등의 사소한 의견입니다 (Chore)

Summary by CodeRabbit

  • Refactor
    • 댓글 단건 보기의 루트/대댓글, 그리고 방 멤버 목록 조회 응답에서 필드명을 ‘alias’ → ‘aliasName’으로 통일했습니다. 기능 동작은 동일하나, 클라이언트는 응답 키 변경을 반영해야 합니다.
  • Tests
    • 응답 스키마 변경에 맞춰 관련 API 테스트를 업데이트했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

Walkthrough

응답 DTO의 필드명을 alias → aliasName으로 통일하고, 해당 매핑(MapStruct)과 서비스 빌더, 그리고 관련 API 테스트의 필드 참조를 일괄 수정했습니다. 기능 로직 변경은 없으며, 공개 응답 스키마의 필드명만 변경되었습니다.

Changes

Cohort / File(s) Summary of Changes
Comment response + mapper
src/main/java/.../comment/adapter/in/web/response/CommentForSinglePostResponse.java, src/main/java/.../comment/application/mapper/CommentQueryMapper.java
DTO 필드명 alias → aliasName으로 변경. MapStruct 매핑에 aliasName 매핑 추가(root.alias, child.alias 소스).
Room member list response + service
src/main/java/.../room/adapter/in/web/response/RoomGetMemberListResponse.java, src/main/java/.../room/application/service/RoomGetMemberListService.java
MemberSearchResult의 필드 및 빌더 메서드 alias → aliasName으로 변경. 서비스에서 빌더 호출도 aliasName(...)으로 수정.
API test
src/test/java/.../room/adapter/in/web/RoomGetMemberListApiTest.java
JSON 응답 검증 경로를 $.data.userList[*].alias → aliasName으로 변경.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
alias 관련 response 변수 네이밍 통일: aliasName 적용 [#200]
alias 관련 response 변수 네이밍 통일: aliasColor 적용 [#200] aliasColor 관련 필드/매핑 변경이 보이지 않음.

Possibly related PRs

Suggested labels

🍀 refactor

Suggested reviewers

  • buzz0331
  • hd0rable

Poem

토끼는 깡총, 이름표 정돈해
alias는 안녕, aliasName 만세!
당근같이 또렷한 응답의 길✨
필드가 맞춰져 리듬이 살지요
깡충깡충 PR에 도장— 승인 고고! 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/#200-alias-related-response-naming

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

Test Results

374 tests  ±0   374 ✅ ±0   31s ⏱️ -1s
110 suites ±0     0 💤 ±0 
110 files   ±0     0 ❌ ±0 

Results for commit 2a5959d. ± Comparison against base commit 859479f.

@seongjunnoh seongjunnoh merged commit f5a1e1b into develop Aug 12, 2025
3 of 4 checks passed
@seongjunnoh seongjunnoh deleted the hotfix/#200-alias-related-response-naming branch August 12, 2025 14:27
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 (6)
src/main/java/konkuk/thip/comment/adapter/in/web/response/CommentForSinglePostResponse.java (2)

15-16: alias → aliasName 리네이밍은 적절합니다. (하위 호환성 확보를 위해 @JsonAlias 추가를 권장)

외부 클라이언트가 여전히 "alias" 필드를 사용 중일 수 있으므로, 단기간 동안의 하위 호환을 위해 @JsonAlias("alias")를 붙여주는 것을 권장합니다. 동일한 맥락으로 ReplyDto에도 적용해 주세요.

적용 예(선택):

-            String aliasName,
+            @com.fasterxml.jackson.annotation.JsonAlias("alias")
+            String aliasName,
-                String aliasName,
+                @com.fasterxml.jackson.annotation.JsonAlias("alias")
+                String aliasName,

추가 import(파일 상단):

import com.fasterxml.jackson.annotation.JsonAlias;

하위 호환이 필요 없고 클라이언트가 모두 정리되었다면 이 제안은 무시하셔도 됩니다. 변경에 따른 외부 영향 범위를 한 번 더 확인해 주세요.

Also applies to: 30-31


38-42: 주석 오타 정정: isDelete → isDeleted

레코드 필드명이 isDeleted이므로 주석도 일치시키면 가독성이 좋아집니다.

-         * 삭제된 루트 댓글에 매핑되는 response dto
-         * isDelete 제외 나머지 데이터는 모두 쓰레기 값으로
+         * 삭제된 루트 댓글에 매핑되는 response dto
+         * isDeleted 제외 나머지 데이터는 모두 쓰레기 값으로
src/main/java/konkuk/thip/room/adapter/in/web/response/RoomGetMemberListResponse.java (1)

17-18: alias → aliasName 리네이밍 적합. (필요 시 @JsonAlias 추가로 API 하위 호환 보완)

Room 멤버 리스트 응답도 필드명 통일이 잘 반영되었습니다. 만약 일부 소비자(clients)가 아직 alias를 참조한다면 일시적으로 @JsonAlias("alias")를 추가해 부드러운 마이그레이션을 지원할 수 있습니다.

-                String aliasName,
+                @com.fasterxml.jackson.annotation.JsonAlias("alias")
+                String aliasName,

추가 import:

import com.fasterxml.jackson.annotation.JsonAlias;

전 소비자가 모두 aliasName으로 전환되었는지 확인 부탁드립니다.

src/main/java/konkuk/thip/comment/application/mapper/CommentQueryMapper.java (1)

34-35: Reply 매핑에도 aliasColor 명시 매핑 검토

Reply에도 동일한 위험이 있으므로 필요 시 아래와 같이 보완해 주세요.

     @Mapping(target = "postDate", expression = "java(DateUtil.formatBeforeTime(child.createdAt()))")
     @Mapping(target = "aliasName", source = "child.alias")
+    @Mapping(target = "aliasColor", source = "child.aliasColor") // 실제 소스명 확인 필요
     CommentForSinglePostResponse.RootCommentDto.ReplyDto toReply(CommentQueryDto child, @Context Set<Long> likedCommentIds);
src/test/java/konkuk/thip/room/adapter/in/web/RoomGetMemberListApiTest.java (1)

154-156: 테스트의 필드명 변경 반영 LGTM. (표제/메서드 명의 용어도 통일 권장: alias → aliasName, subscriber → follower)

JSON Path의 aliasName 반영은 적절합니다. 테스트 설명과 메서드명에 남아 있는 alias/subscriber 표현도 통일하면 혼란을 줄일 수 있습니다.

권장 수정(파일 내 다른 라인에 대한 변경):

-    @DisplayName("방 멤버 리스트(독서메이트)가 userId, nickname, imageUrl, alias, subscriberCount로 조회된다.")
+    @DisplayName("방 멤버 리스트(독서메이트)가 userId, nickname, imageUrl, aliasName, followerCount로 조회된다.")

-    @DisplayName("팔로워 수가 올바르게 집계된다.")
+    @DisplayName("followerCount가 올바르게 집계된다.")
-    void getRoomMemberList_subscriberCount() throws Exception {
+    void getRoomMemberList_followerCount() throws Exception {

-    @DisplayName("팔로워가 한 명도 없는 사용자는 followerCount가 0으로 조회된다.")
+    @DisplayName("팔로워가 한 명도 없는 사용자는 followerCount가 0으로 조회된다.") // 동일하지만 메서드명 일관성 개선
-    void getRoomMemberList_noSubscriber() throws Exception {
+    void getRoomMemberList_noFollower() throws Exception {

Also applies to: 159-161, 164-166

src/main/java/konkuk/thip/room/application/service/RoomGetMemberListService.java (1)

54-55: aliasName 빌더 적용은 적절하나, null 안전성 재확인 필요

user.getAlias()가 항상 non-null이라고 보장되는지 도메인 제약을 다시 한 번 검토해 주세요. 만약 alias가 null이 될 수 있다면 NPE 방지를 위해 null 체크를 추가하거나, 도메인 레벨에서 alias 비어있음이 불가능하도록 설계해야 합니다. 또한 getAlias() 호출 결과를 로컬 변수에 담아 재사용하면 가독성과 안정성이 소폭 개선됩니다.

아래 위치에서도 aliasName/aliasColor 필드가 테스트 및 매핑에서 사용되고 있으니, 전역 영향 범위를 확인하세요.

  • src/main/java/konkuk/thip/room/application/service/RoomGetMemberListService.java (54–55행): .aliasName(user.getAlias().getValue())
  • src/test/java/konkuk/thip/room/adapter/in/web/RoomGetMemberListApiTest.java 등 JSONPath assertions ($.data.userList[].aliasName)
  • src/main/java/konkuk/thip/feed/application/mapper/FeedQueryMapper.java,
    src/main/java/konkuk/thip/comment/application/mapper/CommentQueryMapper.java의 @Mapping(target = "aliasName"/"aliasColor", source = "...alias...")

[getAlias() 호출 결과를 변수에 담아 재사용]

- .aliasName(user.getAlias().getValue())
+ var alias = user.getAlias(); // null 불가 전제라면 그대로, 아니라면 null 체크 필요
+ .aliasName(alias != null ? alias.getValue() : null)

위 사항을 확인 후, alias null 허용 여부에 따라 필요한 변경을 적용해 주세요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 859479f and 2a5959d.

📒 Files selected for processing (5)
  • src/main/java/konkuk/thip/comment/adapter/in/web/response/CommentForSinglePostResponse.java (2 hunks)
  • src/main/java/konkuk/thip/comment/application/mapper/CommentQueryMapper.java (1 hunks)
  • src/main/java/konkuk/thip/room/adapter/in/web/response/RoomGetMemberListResponse.java (1 hunks)
  • src/main/java/konkuk/thip/room/application/service/RoomGetMemberListService.java (1 hunks)
  • src/test/java/konkuk/thip/room/adapter/in/web/RoomGetMemberListApiTest.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#113
File: src/main/java/konkuk/thip/recentSearch/adapter/out/persistence/RecentSearchCommandPersistenceAdapter.java:38-44
Timestamp: 2025-07-30T14:05:04.945Z
Learning: seongjunnoh는 코드 최적화 제안에 대해 구체적인 기술적 근거와 효율성 차이를 이해하고 싶어하며, 성능 개선 방식에 대한 상세한 설명을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#93
File: src/main/java/konkuk/thip/room/adapter/out/persistence/RoomQueryPersistenceAdapter.java:49-114
Timestamp: 2025-07-28T16:44:31.224Z
Learning: seongjunnoh는 코드 중복 문제에 대한 리팩토링 제안을 적극적으로 수용하고 함수형 인터페이스를 활용한 해결책을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#112
File: src/main/java/konkuk/thip/feed/adapter/out/persistence/repository/FeedQueryRepositoryImpl.java:272-272
Timestamp: 2025-07-30T10:44:34.115Z
Learning: seongjunnoh는 피드 커서 페이지네이션에서 LocalDateTime 단일 커서 방식을 선호하며, 복합 키 기반 커서보다 구현 단순성과 성능을 우선시한다.
🔇 Additional comments (1)
src/main/java/konkuk/thip/comment/application/mapper/CommentQueryMapper.java (1)

26-27: aliasColor 매핑은 자동으로 지원되므로 추가 명시 매핑 불필요합니다.

CommentQueryDto에 aliasColor 필드가 정의되어 있어 MapStruct가 기본 명명 규칙에 따라 aliasColor → aliasColor를 자동 매핑합니다. 별도의 @Mapping 추가 없이도 정상 동작합니다.

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/test/java/konkuk/thip/room/adapter/in/web/RoomGetMemberListApiTest.java (1)

139-139: 테스트 설명 주석을 업데이트해야 함

테스트 설명에서 여전히 "alias"로 표기되어 있는데, 실제 검증하는 필드명은 "aliasName"으로 변경되었습니다. 일관성을 위해 주석도 수정하는 것을 권장합니다.

-@DisplayName("방 멤버 리스트(독서메이트)가 userId, nickname, imageUrl, alias, subscriberCount로 조회된다.")
+@DisplayName("방 멤버 리스트(독서메이트)가 userId, nickname, imageUrl, aliasName, subscriberCount로 조회된다.")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 859479f and 2a5959d.

📒 Files selected for processing (5)
  • src/main/java/konkuk/thip/comment/adapter/in/web/response/CommentForSinglePostResponse.java (2 hunks)
  • src/main/java/konkuk/thip/comment/application/mapper/CommentQueryMapper.java (1 hunks)
  • src/main/java/konkuk/thip/room/adapter/in/web/response/RoomGetMemberListResponse.java (1 hunks)
  • src/main/java/konkuk/thip/room/application/service/RoomGetMemberListService.java (1 hunks)
  • src/test/java/konkuk/thip/room/adapter/in/web/RoomGetMemberListApiTest.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#113
File: src/main/java/konkuk/thip/recentSearch/adapter/out/persistence/RecentSearchCommandPersistenceAdapter.java:38-44
Timestamp: 2025-07-30T14:05:04.945Z
Learning: seongjunnoh는 코드 최적화 제안에 대해 구체적인 기술적 근거와 효율성 차이를 이해하고 싶어하며, 성능 개선 방식에 대한 상세한 설명을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#93
File: src/main/java/konkuk/thip/room/adapter/out/persistence/RoomQueryPersistenceAdapter.java:49-114
Timestamp: 2025-07-28T16:44:31.224Z
Learning: seongjunnoh는 코드 중복 문제에 대한 리팩토링 제안을 적극적으로 수용하고 함수형 인터페이스를 활용한 해결책을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#112
File: src/main/java/konkuk/thip/feed/adapter/out/persistence/repository/FeedQueryRepositoryImpl.java:272-272
Timestamp: 2025-07-30T10:44:34.115Z
Learning: seongjunnoh는 피드 커서 페이지네이션에서 LocalDateTime 단일 커서 방식을 선호하며, 복합 키 기반 커서보다 구현 단순성과 성능을 우선시한다.
🔇 Additional comments (10)
src/main/java/konkuk/thip/room/adapter/in/web/response/RoomGetMemberListResponse.java (1)

17-17: 필드명 통일 변경사항이 정확하게 적용됨

alias에서 aliasName으로 필드명이 변경되어 이슈 #200의 요구사항에 부합합니다.

src/main/java/konkuk/thip/comment/adapter/in/web/response/CommentForSinglePostResponse.java (3)

15-15: RootCommentDto의 필드명 통일이 올바르게 적용됨

alias에서 aliasName으로 필드명이 변경되어 일관성을 확보했습니다.


30-30: ReplyDto의 필드명 통일이 올바르게 적용됨

alias에서 aliasName으로 필드명이 변경되어 RootCommentDto와 일관성을 맞췄습니다.


42-56: aliasName 필드 매핑 검증 완료

createDeletedRootCommentDto가 전달하는 null 값들은 아래 순서대로 매핑되어 있으며, 5번째 파라미터가 aliasName에 정확히 해당합니다.

  • 1: commentId → null
  • 2: creatorId → null
  • 3: creatorProfileImageUrl → null
  • 4: creatorNickname → null
  • 5: aliasName → null
  • 6: aliasColor → null
  • 7: postDate → null
  • 8: content → null
  • 9: likeCount → 0
  • 10: isLike → false
  • 11: isDeleted → true
  • 12: replyList → replyList

추가 수정 사항 없습니다.

src/main/java/konkuk/thip/comment/application/mapper/CommentQueryMapper.java (2)

26-27: 루트 댓글의 aliasName 매핑이 올바르게 추가됨

root.aliasaliasName으로 매핑하는 MapStruct 어노테이션이 정확하게 추가되었습니다.


34-35: 답글의 aliasName 매핑이 올바르게 추가됨

child.aliasaliasName으로 매핑하는 MapStruct 어노테이션이 정확하게 추가되었습니다.

src/test/java/konkuk/thip/room/adapter/in/web/RoomGetMemberListApiTest.java (3)

154-154: 첫 번째 사용자의 aliasName 필드 검증이 올바르게 수정됨

API 응답에서 alias 대신 aliasName 필드를 검증하도록 테스트가 정확하게 업데이트되었습니다.


159-159: 두 번째 사용자의 aliasName 필드 검증이 올바르게 수정됨

API 응답에서 alias 대신 aliasName 필드를 검증하도록 테스트가 정확하게 업데이트되었습니다.


164-164: 세 번째 사용자의 aliasName 필드 검증이 올바르게 수정됨

API 응답에서 alias 대신 aliasName 필드를 검증하도록 테스트가 정확하게 업데이트되었습니다.

src/main/java/konkuk/thip/room/application/service/RoomGetMemberListService.java (1)

54-54: 빌더 메서드명이 올바르게 변경됨

alias()에서 aliasName()으로 빌더 메서드명이 변경되어 응답 DTO의 필드명과 일치합니다. 값 소스(user.getAlias().getValue())는 동일하게 유지되어 기능적 변화는 없습니다.

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.

[THIP2025-253] [hotfix] alias 관련 response 변수 네이밍 통일

1 participant