Skip to content

Commit

Permalink
Merge pull request #287 from Gamegoo-repo/fix/286
Browse files Browse the repository at this point in the history
[Fix/286] countUnreadChats ๋ฉ”์†Œ๋“œ์˜ lastViewDate ๋น„๊ต ์ฟผ๋ฆฌ ์ˆ˜์ •
  • Loading branch information
Eunjin3395 authored Oct 13, 2024
2 parents bfe50fb + b1c9dbd commit 12d47ba
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 12d47ba

Please sign in to comment.