캐릭터 챗봇 #338

Merged
klaus merged 119 commits from test into main 2025-09-10 06:08:47 +00:00
2 changed files with 16 additions and 2 deletions
Showing only changes of commit 6c7f411869 - Show all commits

View File

@ -43,3 +43,12 @@ data class CharacterCommentRepliesResponse(
val original: CharacterCommentResponse, val original: CharacterCommentResponse,
val replies: List<CharacterReplyResponse> val replies: List<CharacterReplyResponse>
) )
// 댓글 리스트 조회 Response 컨테이너
// - 전체 댓글 개수(totalCount)
// - 댓글 목록(comments)
data class CharacterCommentListResponse(
val totalCount: Int,
val comments: List<CharacterCommentResponse>
)

View File

@ -83,13 +83,18 @@ class CharacterCommentService(
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
fun listComments(imageHost: String, characterId: Long, limit: Int = 20): List<CharacterCommentResponse> { fun listComments(imageHost: String, characterId: Long, limit: Int = 20): CharacterCommentListResponse {
val pageable = PageRequest.of(0, limit) val pageable = PageRequest.of(0, limit)
val comments = commentRepository.findByChatCharacter_IdAndIsActiveTrueAndParentIsNullOrderByCreatedAtDesc( val comments = commentRepository.findByChatCharacter_IdAndIsActiveTrueAndParentIsNullOrderByCreatedAtDesc(
characterId, characterId,
pageable pageable
) )
return comments.map { toCommentResponse(imageHost, it) } val items = comments.map { toCommentResponse(imageHost, it) }
val total = getTotalCommentCount(characterId)
return CharacterCommentListResponse(
totalCount = total,
comments = items
)
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)