Skip to content

Commit

Permalink
🐛 [Fix] countUnreadChats 메소드의 lastViewDate 비교 쿼리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjin3395 committed Oct 13, 2024
1 parent 051a583 commit ac46d3b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -131,8 +132,9 @@ public Slice<Chat> findChatsByCursor(Long cursor, Long chatroomId, Long memberCh
//--- BooleanExpression ---//
private BooleanExpression createdAtGreaterThanLastViewDateSubQuery(Long memberChatroomId) {
return chat.createdAt.gt(
JPAExpressions.select(memberChatroom.lastViewDate)
.from(memberChatroom)
JPAExpressions.select(
memberChatroom.lastViewDate.coalesce(LocalDateTime.MIN)
).from(memberChatroom)
.where(memberChatroom.id.eq(memberChatroomId))
);
}
Expand Down

0 comments on commit ac46d3b

Please sign in to comment.