-
Notifications
You must be signed in to change notification settings - Fork 3
[API] 댓글 관련 api 연결 완료 #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f6a696d
e55f373
b142d14
4633a2a
3cfb103
95a9c00
27fce20
86946bd
26f2079
4529f43
45822bf
763c4e4
768afc3
bed9e29
44ab3e0
387cdd0
219cc80
e48a3f1
e8cc4e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.texthip.thip.data.model.comments.request | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class CommentsCreateRequest( | ||
| val content: String, | ||
| val isReplyRequest: Boolean, | ||
| val parentId: Int? = null, | ||
| val postType: String, | ||
| ) | ||
|
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain타입 일관성 및 무결성 보강(빈 콘텐츠/답글 규칙 검증)
아래 변경 제안은 컴파일 타임에 깨지는 부분이 없는지 전체 빌드 확인이 필요합니다. @Serializable
data class CommentsCreateRequest(
val content: String,
val isReplyRequest: Boolean,
- val parentId: Int? = null,
+ val parentId: Long? = null,
val postType: String,
-)
+) {
+ init {
+ require(content.isNotBlank()) { "content must not be blank" }
+ if (isReplyRequest) {
+ require(parentId != null) { "parentId is required when isReplyRequest = true" }
+ } else {
+ require(parentId == null) { "parentId must be null when isReplyRequest = false" }
+ }
+ }
+}무결성 체크를 모델에 두는 것이 부담이라면 Repository 레이어에서 요청 생성 전에 동일한 검증을 수행하는 것도 괜찮습니다. 🏁 Script executed: #!/bin/bash
set -e
echo "🔍 Searching for usages of CommentsCreateRequest in the codebase"
rg "CommentsCreateRequest" -n .
echo "🔍 Searching for all occurrences of parentId to see how it’s consumed"
rg "parentId" -n .Length of output: 2313 🏁 Script executed: #!/bin/bash
set -e
echo "🔍 CommentsService.kt 상단 확인"
sed -n '1,200p' app/src/main/java/com/texthip/thip/data/service/CommentsService.kt
echo
echo "🔍 CommentsRepository.kt 주요 메서드 시그니처 확인"
sed -n '1,200p' app/src/main/java/com/texthip/thip/data/repository/CommentsRepository.ktLength of output: 3197 CommentsCreateRequest의 parentId 타입 일관화 및 무결성 검증 추가 필요 수정이 필요한 위치:
예시 변경안 (CommentsCreateRequest.kt): @Serializable
data class CommentsCreateRequest(
val content: String,
val isReplyRequest: Boolean,
- val parentId: Int? = null,
+ val parentId: Long? = null,
val postType: String,
) {
init {
require(content.isNotBlank()) { "content must not be blank" }
if (isReplyRequest) {
require(parentId != null) { "parentId is required when isReplyRequest = true" }
} else {
require(parentId == null) { "parentId must be null when isReplyRequest = false" }
}
}
}변경 후 전체 빌드 및 테스트를 반드시 확인해주세요. 🤖 Prompt for AI Agents
Comment on lines
+6
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion ID 타입 불일치: parentId를 Long?으로 통일하세요 네트워크 계층(CommentsService)의 Path 파라미터들은 Long을 사용하고 있습니다. 여기에 매핑되는 parentId만 Int?인 것은 타입 불일치로, 장기적으로 오버플로 및 일관성 저하의 원인이 됩니다. 댓글/답글의 식별자는 전반적으로 Long을 사용하는 쪽으로 통일하는 것을 권장합니다. 적용 예시: data class CommentsCreateRequest(
val content: String,
val isReplyRequest: Boolean,
- val parentId: Int? = null,
+ val parentId: Long? = null,
val postType: String,
)🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.texthip.thip.data.model.comments.request | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class CommentsLikesRequest( | ||
| val type: Boolean | ||
| ) |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||||
| package com.texthip.thip.data.model.comments.response | ||||||||||
|
|
||||||||||
| import kotlinx.serialization.Serializable | ||||||||||
|
|
||||||||||
| @Serializable | ||||||||||
| data class CommentsCreateResponse( | ||||||||||
| val commentId: Int, | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion ID 타입 일관성: Int → Long으로 변경 권장 댓글·게시글 ID 전반을 Long으로 일관되게 사용하는 편이 안전합니다(특히 Service/Repository에서 Long 사용 중). 응답 commentId도 Long으로 맞추는 것을 제안드립니다. data class CommentsCreateResponse(
- val commentId: Int,
+ val commentId: Long,
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| ) | ||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||||||||||||||||||||||||||
| package com.texthip.thip.data.model.comments.response | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import kotlinx.serialization.Serializable | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @Serializable | ||||||||||||||||||||||||||||||||||
| data class CommentsLikesResponse( | ||||||||||||||||||||||||||||||||||
| val commentId: Int, | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion ID 타입 일관성: Int → Long으로 변경 권장 Service 레이어에서 path param이 Long(예: likeComment(commentId: Long))으로 사용되고 있어 응답 모델의 commentId도 Long으로 맞추는 편이 안전합니다. 타입 불일치가 있으면 매핑·캐스팅 비용과 잠재적 오버플로/트렁케이션 이슈가 생길 수 있습니다. 다음과 같이 변경을 제안합니다: data class CommentsLikesResponse(
- val commentId: Int,
+ val commentId: Long,
val isLiked: Boolean,
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| val isLiked: Boolean, | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainID 타입 일관성 검토 필요 — Int → Long로 통일 제안 Response의 commentId가 Int인데, Service 계층에서 commentId 매개변수를 Long으로 사용하는 경우가 많습니다. 도메인 전반에서 ID는 Long으로 통일하는 것을 권장합니다. 또한 서버 필드명이 snake_case(comment_id)라면 @SerialName 지정이 필요합니다. 제안 변경: -import kotlinx.serialization.Serializable
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.SerialName
@Serializable
data class CommentsLikesResponse(
- val commentId: Int,
+ /* 서버가 snake_case를 사용한다면 다음과 같이 지정:
+ @SerialName("comment_id")
+ */
+ val commentId: Long,
val isLiked: Boolean,
)검증 스크립트(서비스 시그니처와 다른 모델의 commentId 타입을 조사): 🏁 Script executed: #!/bin/bash
# CommentsService의 likeComment 시그니처와 commentId 타입을 확인
echo "=== CommentsService likeComment signatures ==="
rg -n -A 3 -B 2 $'interface\\s+CommentsService|likeComment\\s*\\('
echo
echo "=== Response/Model 내 commentId 타입 현황 ==="
rg -n -A 1 -B 1 $'commentId\\s*:\\s*(Int|Long)'
echo
echo "=== Repository 계층에서 likeComment 사용부 ==="
rg -n -A 3 -B 2 $'likeComment\\s*\\('Length of output: 11283 🏁 Script executed: #!/bin/bash
# Search for JSON serializer configuration and naming strategies
echo "=== kotlinx.serialization.json.Json instantiations ==="
rg -n "kotlinx.serialization.json.Json" -A 3 -B 3
echo
echo "=== Any custom Json builders or module installs ==="
rg -n "Json\\s*\\{" -A 3 -B 3
echo
echo "=== SerialName usages across models ==="
rg -n "SerialName"
echo
echo "=== References to naming strategy or snake_case ==="
rg -n "snake" -A 2 -B 2Length of output: 22080 CommentsLikesResponse.commentId → Long 및 @SerialName("comment_id") 적용 제안 CommentsService와 CommentsRepository 모두 commentId를 Long으로 사용하고, 프로젝트 전반에서 ID를 Long으로 통일하고 있습니다. 또한 NetWorkModule에서 snake_case 자동 변환 설정을 사용하지 않으므로, 서버가 • 대상 파일 • 제안 변경사항 -import kotlinx.serialization.Serializable
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.SerialName
@Serializable
data class CommentsLikesResponse(
- val commentId: Int,
+ @SerialName("comment_id")
+ val commentId: Long,
val isLiked: Boolean,
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.texthip.thip.data.model.comments.response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import kotlinx.serialization.Serializable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Serializable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data class CommentsResponse( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val commentList: List<CommentList>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val nextCursor: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val isLast: Boolean, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 디코딩 탄탄함 확보: 기본값으로 방어적 직렬화 네트워크 응답에서 일부 필드가 누락될 수 있는 상황(서버 진화, 실험 플래그 등)을 고려해 @Serializable
data class CommentsResponse(
- val commentList: List<CommentList>,
- val nextCursor: String?,
+ val commentList: List<CommentList> = emptyList(),
+ val nextCursor: String? = null,
val isLast: Boolean,
)🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Serializable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data class CommentList( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val commentId: Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val creatorId: Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val creatorProfileImageUrl: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val creatorNickname: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val aliasName: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val aliasColor: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val postDate: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val content: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val likeCount: Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val isDeleted: Boolean, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val isLike: Boolean, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val replyList: List<ReplyList>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion replyList 기본값으로 파싱 안정성 강화 댓글에 대댓글이 없을 때 서버가 @Serializable
data class CommentList(
@@
- val replyList: List<ReplyList>,
+ val replyList: List<ReplyList> = emptyList(),
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Serializable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data class ReplyList( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val commentId: Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val parentCommentCreatorNickname: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val creatorId: Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val creatorProfileImageUrl: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val creatorNickname: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val aliasName: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val aliasColor: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val postDate: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val content: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val likeCount: Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val isLike: Boolean, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain서버 키 네이밍(camelCase/snake_case) 및 직렬화 설정 점검 프로퍼티들이 camelCase입니다. 서버가 snake_case로 응답한다면 다음 스크립트로 프로젝트 내 직렬화 설정과
🏁 Script executed: #!/bin/bash
# 직렬화 설정/사용 패턴 점검
echo "[Json 설정 탐색]"
rg -n "Json\\(" -A 5
echo
echo "[Retrofit + Kotlinx Serialization 연결(asConverterFactory) 탐색]"
rg -n "asConverterFactory|kotlinx.serialization" -A 3
echo
echo "[@SerialName 사용 사례 탐색]"
rg -n "@SerialName\\(" -A 1
echo
echo "[CommentsService/Response 사용처 탐색]"
rg -n "CommentsService|CommentsResponse|CommentList|ReplyList" -A 3Length of output: 63158 서버 응답 필드 네이밍 일관성 검토 및 직렬화 설정 보완 필요 현재 또한 다음 중 한 가지 방법으로 수정해주세요.
Retrofit-Kotlinx-Serialization 연결( 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ data class RoomsPlayingResponse( | |
| val progressStartDate: String, | ||
| val progressEndDate: String, | ||
| val category: String, | ||
| val categoryColor: String, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain신규 비-선택적 필드 추가로 인한 역직렬화/구캐시 크래시 가능 — 기본값 추가 권장 서버가 아직 categoryColor를 안 주거나, 로컬에 구버전 응답 JSON이 캐시되어 있으면 크래시가 발생할 수 있습니다. 기본값을 추가해 방어적으로 처리해 주세요. - val categoryColor: String,
+ val categoryColor: String = "#A0F8E8",또한, 프로젝트 전반에서 수동 생성하는 RoomsPlayingResponse 호출부(미리보기/샘플 데이터 등)가 있다면 인자 개수 불일치가 없는지 확인해 주세요. 아래 스크립트로 사용처를 점검할 수 있습니다. 🏁 Script executed: #!/bin/bash
# RoomsPlayingResponse 생성자 사용처 점검
rg -n -A 2 $'RoomsPlayingResponse\\('Length of output: 724 기본값 없는 서버 응답에
🤖 Prompt for AI Agents |
||
| val roomDescription: String, | ||
| val memberCount: Int, | ||
| val recruitCount: Int, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ data class UserList( | |||||
| val userId: Int, | ||||||
| val nickname: String, | ||||||
| val imageUrl: String, | ||||||
| val aliasColor: String, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain서버 응답에 필드 누락 시 역직렬화 실패 위험 — 기본값 추가 권장 kotlinx.serialization에서 비-선택적(non-optional) 필드가 서버 응답에 없으면 MissingFieldException으로 크래시가 납니다. BE/앱 릴리스 타이밍 차이나 구캐시(JSON) 대응을 위해 기본값을 두는 편이 안전합니다. 서버에서 항상 aliasColor를 주는지 확인해 주세요. 주지 않는 경우 아래처럼 기본값을 추가하는 것을 권장합니다. - val aliasColor: String,
+ val aliasColor: String = "#A0F8E8",아래 스크립트로 🏁 Script executed: #!/bin/bash
# RoomsUsersResponse.kt 위치 찾기
file=$(fd RoomsUsersResponse.kt)
echo "Found file: $file"
# 클래스 선언부와 aliasColor 필드 확인
rg -n "data class RoomsUsersResponse" -C5 "$file"
rg -n "aliasColor" -C3 "$file"Length of output: 963 aliasColor 기본값 지정 권장 — 역직렬화 안정성 확보 kotlinx.serialization에서 non-optional 필드(
- val aliasColor: String,
+ val aliasColor: String = "#A0F8E8",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| val aliasName: String, | ||||||
| val followerCount: Int, | ||||||
| ) | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package com.texthip.thip.data.repository | ||
|
|
||
| import com.texthip.thip.data.model.base.handleBaseResponse | ||
| import com.texthip.thip.data.model.comments.request.CommentsCreateRequest | ||
| import com.texthip.thip.data.model.comments.request.CommentsLikesRequest | ||
| import com.texthip.thip.data.service.CommentsService | ||
| import javax.inject.Inject | ||
| import javax.inject.Singleton | ||
|
|
||
| @Singleton | ||
| class CommentsRepository @Inject constructor( | ||
| private val commentsService: CommentsService, | ||
| ) { | ||
| suspend fun getComments( | ||
| postId: Long, | ||
| postType: String = "RECORD", | ||
| cursor: String? = null, | ||
| ) = runCatching { | ||
| commentsService.getComments( | ||
| postId = postId, | ||
| postType = postType, | ||
| cursor = cursor | ||
| ).handleBaseResponse().getOrThrow() | ||
| } | ||
|
Comment on lines
+14
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion postType을 String 상수로 노출하지 말고 강타입으로 관리하세요
예시(요약):
🤖 Prompt for AI Agents |
||
|
|
||
| suspend fun likeComment( | ||
| commentId: Long, | ||
| type: Boolean | ||
| ) = runCatching { | ||
| commentsService.likeComment( | ||
| commentId = commentId, | ||
| response = CommentsLikesRequest(type) | ||
| ).handleBaseResponse().getOrThrow() | ||
| } | ||
|
|
||
| suspend fun createComment( | ||
| postId: Long, | ||
| content: String, | ||
| isReplyRequest: Boolean, | ||
| parentId: Int? = null, | ||
| postType: String = "RECORD", | ||
| ) = runCatching { | ||
| commentsService.createComment( | ||
| postId = postId, | ||
| request = CommentsCreateRequest( | ||
| content = content, | ||
| isReplyRequest = isReplyRequest, | ||
| parentId = parentId, | ||
| postType = postType | ||
| ) | ||
| ).handleBaseResponse().getOrThrow() | ||
| } | ||
|
Comment on lines
+36
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainID 타입 일관성 검토: parentId(Int?) vs commentId(Long)
원본 모델/서비스 시그니처의 타입을 점검한 뒤 통일을 제안드립니다. 검색 스크립트: 🏁 Script executed: #!/bin/bash
# commentId/parentId 타입 선언을 전역 검색
rg -n -A 2 -B 2 $'commentId\\s*:\\s*(Int|Long)|parentId\\s*:\\s*(Int|Long)' app/src/main/javaLength of output: 8010 🏁 Script executed: #!/bin/bash
# Search for createComment signature in CommentsService.kt
rg -n "createComment" app/src/main/java/com/texthip/thip/data/service/CommentsService.ktLength of output: 122 🏁 Script executed: #!/bin/bash
# Get the definition of createComment in CommentsService.kt with context
rg -n -A3 -B3 "suspend fun createComment" app/src/main/java/com/texthip/thip/data/service/CommentsService.ktLength of output: 364 ID 타입 통일: 댓글 관련 ID를 모두 Long으로 변경 필요 Service( • app/src/main/java/com/texthip/thip/data/model/comments/request/CommentsCreateRequest.kt
예시 diff: --- CommentsCreateRequest.kt
- val parentId: Int? = null,
+ val parentId: Long? = null,
--- CommentsCreateResponse.kt
- val commentId: Int,
+ val commentId: Long,위 파일들을 포함해 댓글 ID를 다루는 모든 레이어(UI 모델/이벤트, ViewModel, Repository, Service, DTO)에서
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||||||||||||||||||||
| package com.texthip.thip.data.service | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import com.texthip.thip.data.model.base.BaseResponse | ||||||||||||||||||||||||
| import com.texthip.thip.data.model.comments.request.CommentsCreateRequest | ||||||||||||||||||||||||
| import com.texthip.thip.data.model.comments.request.CommentsLikesRequest | ||||||||||||||||||||||||
| import com.texthip.thip.data.model.comments.response.CommentsCreateResponse | ||||||||||||||||||||||||
| import com.texthip.thip.data.model.comments.response.CommentsLikesResponse | ||||||||||||||||||||||||
| import com.texthip.thip.data.model.comments.response.CommentsResponse | ||||||||||||||||||||||||
| import retrofit2.http.Body | ||||||||||||||||||||||||
| import retrofit2.http.GET | ||||||||||||||||||||||||
| import retrofit2.http.POST | ||||||||||||||||||||||||
| import retrofit2.http.Path | ||||||||||||||||||||||||
| import retrofit2.http.Query | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| interface CommentsService { | ||||||||||||||||||||||||
| @GET("comments/{postId}") | ||||||||||||||||||||||||
| suspend fun getComments( | ||||||||||||||||||||||||
| @Path("postId") postId: Long, | ||||||||||||||||||||||||
| @Query("postType") postType: String = "RECORD", | ||||||||||||||||||||||||
| @Query("cursor") cursor: String? = null, | ||||||||||||||||||||||||
| ): BaseResponse<CommentsResponse> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @POST("comments/{commentId}/likes") | ||||||||||||||||||||||||
| suspend fun likeComment( | ||||||||||||||||||||||||
| @Path("commentId") commentId: Long, | ||||||||||||||||||||||||
| @Body response: CommentsLikesRequest | ||||||||||||||||||||||||
| ): BaseResponse<CommentsLikesResponse> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @POST("comments/{postId}") | ||||||||||||||||||||||||
| suspend fun createComment( | ||||||||||||||||||||||||
| @Path("postId") postId: Long, | ||||||||||||||||||||||||
| @Body request: CommentsCreateRequest | ||||||||||||||||||||||||
| ): BaseResponse<CommentsCreateResponse> | ||||||||||||||||||||||||
|
Comment on lines
+29
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chaincreateComment의 타입 일관성 점검(IDs Long 통일) createComment의 Path는 Long(postId)인데, 요청 바디의 parentId가 현재 Int?로 설계되어 있습니다. 상위 모델(CommentsCreateRequest)의 parentId를 Long?으로 정렬해야 합니다. 상단 파일 코멘트를 참고해 일괄 통일을 권장합니다. 🏁 Script executed: #!/bin/bash
# Locate the CommentsCreateRequest definition to verify the type of parentId
rg "class CommentsCreateRequest" -n .Length of output: 165 🏁 Script executed: #!/bin/bash
# 확인: CommentsCreateRequest 내 parentId 타입 조회
rg "parentId" -n app/src/main/java/com/texthip/thip/data/model/comments/request/CommentsCreateRequest.ktLength of output: 137 parentId 타입을 Long? 으로 통일해주세요 CommentsService.createComment API의 postId가 Long으로 정의되어 있으니, 요청 바디의 parentId도 Long? 으로 변경해 타입 일관성을 유지해야 합니다. 수정 대상:
제안된 변경: - val parentId: Int? = null,
+ val parentId: Long? = null,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -48,12 +48,8 @@ import com.texthip.thip.ui.common.forms.CommentTextField | |||||
| import com.texthip.thip.ui.common.header.ProfileBar | ||||||
| import com.texthip.thip.ui.common.modal.DialogPopup | ||||||
| import com.texthip.thip.ui.common.topappbar.DefaultTopAppBar | ||||||
| import com.texthip.thip.ui.group.note.component.CommentItem | ||||||
| import com.texthip.thip.ui.group.note.component.ReplyItem | ||||||
| import com.texthip.thip.ui.feed.component.ImageViewerModal | ||||||
| import com.texthip.thip.ui.feed.mock.FeedItemType | ||||||
| import com.texthip.thip.ui.group.note.component.CommentItem | ||||||
| import com.texthip.thip.ui.group.note.component.ReplyItem | ||||||
| import com.texthip.thip.ui.group.note.mock.mockCommentList | ||||||
| import com.texthip.thip.ui.group.room.mock.MenuBottomSheetItem | ||||||
| import com.texthip.thip.ui.mypage.mock.FeedItem | ||||||
|
|
@@ -241,10 +237,10 @@ fun FeedCommentScreen( | |||||
| ) | ||||||
| } | ||||||
| ) { | ||||||
| CommentItem( | ||||||
| data = commentItem, | ||||||
| onReplyClick = { replyTo.value = it } | ||||||
| ) | ||||||
| // CommentItem( | ||||||
| // data = commentItem, | ||||||
| // onReplyClick = { replyTo.value = it } | ||||||
| // ) | ||||||
| } | ||||||
|
Comment on lines
+240
to
244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 댓글 UI가 비활성화되어 사용자에게 보이지 않습니다 핵심 렌더링인 즉시 복구 예시(필요시 -// CommentItem(
-// data = commentItem,
-// onReplyClick = { replyTo.value = it }
-// )
+ CommentItem(
+ data = commentItem,
+ onReplyClick = { replyTo.value = it }
+ )의도적으로 임시 비활성화라면, 빌드 플래그/실험 플래그로 제어해 회귀를 방지해 주세요: val showCommentsUi = true // or BuildConfig.FEATURE_FEED_COMMENTS
if (showCommentsUi) {
CommentItem(...)
}🤖 Prompt for AI Agents
Comment on lines
+240
to
244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 회귀 위험: 댓글 아이템 렌더링이 주석 처리되어 UI가 비어 보입니다 주석 처리로 인해 CommentList가 비어있지 않아도 실제 댓글 본문이 화면에 표시되지 않습니다. 최소한의 폴백 UI라도 렌더링하도록 복구하시길 권장합니다. 간단 폴백 렌더링(해당 블록 대체): -// CommentItem(
-// data = commentItem,
-// onReplyClick = { replyTo.value = it }
-// )
+ Column {
+ Text(
+ text = commentItem.nickName,
+ style = typography.view_m500_s14,
+ color = colors.White
+ )
+ Spacer(modifier = Modifier.height(4.dp))
+ Text(
+ text = commentItem.content,
+ style = typography.feedcopy_r400_s14_h20,
+ color = colors.White
+ )
+ }주의: 새로운 통합 코멘트 UI(뷰모델/상태 기반)로 대체 예정이라면, 해당 연결 전까지 임시 폴백을 유지해 사용자 경험 저하를 방지하세요. 🤖 Prompt for AI Agents |
||||||
| if (selectedComment == commentItem) { | ||||||
| Row( | ||||||
|
|
@@ -304,7 +300,7 @@ fun FeedCommentScreen( | |||||
| ) | ||||||
| } | ||||||
| ) { | ||||||
| ReplyItem(data = reply, onReplyClick = { replyTo.value = it }) | ||||||
| // ReplyItem(data = reply, onReplyClick = { replyTo.value = it }) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 대댓글 UI도 비활성화되어 있습니다
복구 예시(필요시 -// ReplyItem(data = reply, onReplyClick = { replyTo.value = it })
+ ReplyItem(data = reply, onReplyClick = { replyTo.value = it })📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 회귀 위험: 대댓글 아이템 렌더링도 주석 처리됨 ReplyItem 주석 처리로 대댓글도 표시되지 않습니다. 최소 폴백 UI를 표시해 기능 공백을 피하세요. 간단 폴백 렌더링(해당 라인 교체): -// ReplyItem(data = reply, onReplyClick = { replyTo.value = it })
+ Column {
+ Text(
+ text = "${reply.nickName} ↪ ${reply.parentNickname}",
+ style = typography.info_r400_s12,
+ color = colors.Grey01
+ )
+ Spacer(modifier = Modifier.height(2.dp))
+ Text(
+ text = reply.content,
+ style = typography.feedcopy_r400_s14_h20,
+ color = colors.White
+ )
+ }🤖 Prompt for AI Agents |
||||||
| } | ||||||
|
|
||||||
| if (selectedReply == reply) { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 이거는 어떤 기능인가요?