fix(home-following): 최근 대화를 팔로우 크리에이터로 제한한다

This commit is contained in:
2026-08-19 12:23:33 +09:00
parent b18e40d4fc
commit b1be87b46f
9 changed files with 570 additions and 20 deletions

View File

@@ -87,6 +87,15 @@ interface ChatRoomRepository : JpaRepository<ChatRoom, Long> {
AND pc.isActive = true
AND r.isActive = true
AND m.isActive = true
AND (
:followedCreatorsOnly = false
OR EXISTS (
SELECT cf.id FROM CreatorFollowing cf
WHERE cf.member.id = :memberId
AND cf.creator.id = pc.character.creatorMember.id
AND cf.isActive = true
)
)
AND (
:cursorAt IS NULL
OR m.createdAt < :cursorAt
@@ -110,6 +119,7 @@ interface ChatRoomRepository : JpaRepository<ChatRoom, Long> {
@Param("cursorAt") cursorAt: LocalDateTime?,
@Param("cursorChatType") cursorChatType: String?,
@Param("cursorRoomId") cursorRoomId: Long?,
@Param("followedCreatorsOnly") followedCreatorsOnly: Boolean,
pageable: Pageable
): List<V2ChatRoomListQueryDto>

View File

@@ -17,7 +17,13 @@ class HomeFollowingFacade(
}
val home = homeFollowingQueryService.findHomeFollowing(member)
val recentChats = chatRoomListService.getRooms(member, filter = "ALL", cursor = null, limit = 10).rooms
val recentChats = chatRoomListService.getRooms(
member,
filter = "ALL",
cursor = null,
limit = 10,
followedCreatorsOnly = true
).rooms
return HomeFollowingTabResponse.from(home.copy(recentChats = recentChats))
}

View File

@@ -28,7 +28,8 @@ class ChatRoomListService(
member: Member,
filter: String = ChatRoomListFilter.ALL.name,
cursor: String? = null,
limit: Int = DEFAULT_LIMIT
limit: Int = DEFAULT_LIMIT,
followedCreatorsOnly: Boolean = false
): ChatRoomListPageResponse {
val type = ChatRoomListFilter.from(filter)
val safeLimit = limit.coerceIn(1, DEFAULT_LIMIT)
@@ -41,12 +42,14 @@ class ChatRoomListService(
parsedCursor?.lastMessageAt,
parsedCursor?.chatType,
parsedCursor?.roomId,
followedCreatorsOnly,
pageable
) + dmRoomRepository.findDmChatListRooms(
member.id!!,
parsedCursor?.lastMessageAt,
parsedCursor?.chatType,
parsedCursor?.roomId,
followedCreatorsOnly,
pageable
)
}
@@ -56,6 +59,7 @@ class ChatRoomListService(
parsedCursor?.lastMessageAt,
parsedCursor?.chatType,
parsedCursor?.roomId,
followedCreatorsOnly,
pageable
)
}
@@ -65,6 +69,7 @@ class ChatRoomListService(
parsedCursor?.lastMessageAt,
parsedCursor?.chatType,
parsedCursor?.roomId,
followedCreatorsOnly,
pageable
)
}

View File

@@ -57,6 +57,15 @@ interface UserCreatorChatRoomRepository : JpaRepository<UserCreatorChatRoom, Lon
and opponent.isActive = true
and opponent.member.id <> :memberId
and m.isActive = true
and (
:followedCreatorsOnly = false
or exists (
select cf.id from CreatorFollowing cf
where cf.member.id = :memberId
and cf.creator.id = opponent.member.id
and cf.isActive = true
)
)
and (
:cursorAt is null
or m.createdAt < :cursorAt
@@ -80,6 +89,7 @@ interface UserCreatorChatRoomRepository : JpaRepository<UserCreatorChatRoom, Lon
@Param("cursorAt") cursorAt: LocalDateTime?,
@Param("cursorChatType") cursorChatType: String?,
@Param("cursorRoomId") cursorRoomId: Long?,
@Param("followedCreatorsOnly") followedCreatorsOnly: Boolean,
pageable: Pageable
): List<ChatRoomListQueryDto>
}