Skip to content

Commit

Permalink
[hotfix] fix: 노트 QueryDsl 쿼리 로직 댓글 count 관련 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
elive7 committed Nov 24, 2024
1 parent 8ad9b2d commit e215df3
Showing 1 changed file with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Optional<Note> findById(Long id, Long userId) {
comment.writer.notIn(
JPAExpressions.select(block.blocked)
.from(block)
.where(block.blocker.id.eq(userId))
.where(block.blocker.id.eq(userId).and(block.deletedAt.isNull()))
)
)
.fetchOne()
Expand All @@ -77,18 +77,18 @@ public Slice<Note> findAllByUserId(boolean hasLyrics, Long artistId, Long userId
.join(note.song).fetchJoin()
.join(song.artist, artist).fetchJoin()
.leftJoin(note.comments).fetchJoin()
.leftJoin(block)
.on(block.blocked.eq(note.publisher)
.and(block.blocker.id.eq(userId))
)
.where(
QueryDslUtils.hasLyrics(hasLyrics),
artistId == null ? null : artist.id.eq(artistId),
note.publisher.deletedAt.isNull(),
note.publisher.id.eq(userId),
note.deletedAt.isNull(),
QueryDslUtils.ltCursorId(cursorId, note.id),
block.id.isNull().or(block.deletedAt.isNotNull())
note.publisher.notIn(
JPAExpressions.select(block.blocked)
.from(block)
.where(block.blocker.id.eq(userId).and(block.deletedAt.isNull()))
)
)
.orderBy(note.id.desc())
.limit(pageable.getPageSize() + 1)
Expand All @@ -106,16 +106,16 @@ public Slice<Note> findAllByArtistIds(boolean hasLyrics, List<Long> artistsIds,
.join(note.song).fetchJoin()
.join(song.artist).fetchJoin()
.leftJoin(note.comments).fetchJoin()
.leftJoin(block)
.on(block.blocked.eq(note.publisher)
.and(block.blocker.id.eq(userId))
)
.where(
QueryDslUtils.hasLyrics(hasLyrics),
note.song.artist.id.in(artistsIds),
note.deletedAt.isNull(),
QueryDslUtils.ltCursorId(cursorId, note.id),
block.id.isNull().or(block.deletedAt.isNotNull())
note.publisher.notIn(
JPAExpressions.select(block.blocked)
.from(block)
.where(block.blocker.id.eq(userId).and(block.deletedAt.isNull()))
)
)
.orderBy(note.id.desc())
.limit(pageable.getPageSize() + 1)
Expand All @@ -133,16 +133,16 @@ public Slice<Note> findAllByArtistId(boolean hasLyrics, Long artistId, Long user
.join(note.song).fetchJoin()
.join(song.artist).fetchJoin()
.leftJoin(note.comments).fetchJoin()
.leftJoin(block)
.on(block.blocked.eq(note.publisher)
.and(block.blocker.id.eq(userId))
)
.where(
QueryDslUtils.hasLyrics(hasLyrics),
note.song.artist.id.eq(artistId),
note.deletedAt.isNull(),
QueryDslUtils.ltCursorId(cursorId, note.id),
block.id.isNull().or(block.deletedAt.isNotNull())
note.publisher.notIn(
JPAExpressions.select(block.blocked)
.from(block)
.where(block.blocker.id.eq(userId).and(block.deletedAt.isNull()))
)
)
.orderBy(note.id.desc())
.limit(pageable.getPageSize() + 1)
Expand All @@ -160,16 +160,16 @@ public Slice<Note> findAllBySongId(boolean hasLyrics, Long songId, Long userId,
.join(note.song).fetchJoin()
.join(song.artist).fetchJoin()
.leftJoin(note.comments).fetchJoin()
.leftJoin(block)
.on(block.blocked.eq(note.publisher)
.and(block.blocker.id.eq(userId))
)
.where(
QueryDslUtils.hasLyrics(hasLyrics),
note.song.id.eq(songId),
note.deletedAt.isNull(),
QueryDslUtils.ltCursorId(cursorId, note.id),
block.id.isNull().or(block.deletedAt.isNotNull())
note.publisher.notIn(
JPAExpressions.select(block.blocked)
.from(block)
.where(block.blocker.id.eq(userId).and(block.deletedAt.isNull()))
)
)
.orderBy(note.id.desc())
.limit(pageable.getPageSize() + 1)
Expand All @@ -187,18 +187,18 @@ public Slice<Note> findAllBookmarkedAndByArtistId(boolean hasLyrics, Long artist
.join(note.song).fetchJoin()
.join(song.artist).fetchJoin()
.leftJoin(note.bookmarks, bookmark).fetchJoin()
.leftJoin(block)
.on(block.blocked.eq(note.publisher)
.and(block.blocker.id.eq(userId))
)
.where(
bookmark.user.id.eq(userId)
.and(bookmark.deletedAt.isNull()),
QueryDslUtils.hasLyrics(hasLyrics),
artistId == null ? null : note.song.artist.id.eq(artistId),
note.deletedAt.isNull(),
QueryDslUtils.ltCursorId(cursorId, note.id),
block.id.isNull().or(block.deletedAt.isNotNull())
note.publisher.notIn(
JPAExpressions.select(block.blocked)
.from(block)
.where(block.blocker.id.eq(userId).and(block.deletedAt.isNull()))
)
)
.orderBy(note.id.desc())
.limit(pageable.getPageSize() + 1)
Expand Down

0 comments on commit e215df3

Please sign in to comment.