@@ -64,25 +64,32 @@ class ContentAdapter(
6464 isPrivate : Boolean ,
6565 pageable : Pageable ,
6666 ): Slice <ContentsResult > {
67+ val reportedUserIds = queryFactory.select(contentEntity.userId)
68+ .from(reportedContentEntity)
69+ .join(contentEntity).on(reportedContentEntity.contentId.eq(contentEntity.id))
70+ .where(
71+ reportedContentEntity.reporterId.eq(userId),
72+ contentEntity.deleted.isFalse,
73+ reportedContentEntity.isDeleted.isFalse
74+ )
75+
6776 val query = queryFactory.select(contentEntity, categoryEntity.name, userLogEntity.count(), bookmarkEntity.count())
6877 .from(contentEntity)
6978 .leftJoin(userLogEntity).on(userLogEntity.contentId.eq(contentEntity.id))
7079 .join(categoryEntity).on(categoryEntity.id.eq(contentEntity.categoryId))
71- .leftJoin(reportedContentEntity).on(reportedContentEntity.contentId.eq(contentEntity.id))
7280 .leftJoin(bookmarkEntity).on(bookmarkEntity.contentId.eq(contentEntity.id).and (bookmarkEntity.deleted.isFalse))
7381
7482 FavoriteOrNot (condition.favorites, userId, query) // 북마크 조인 여부
7583
7684 query.where(
7785 if (isPrivate) categoryEntity.userId.eq(userId) else null ,
78- reportedContentEntity.id.isNull. or (reportedContentEntity.reporterId.ne(userId) ),
86+ contentEntity.userId.notIn(reportedUserIds ),
7987 condition.categoryId?.let { categoryEntity.id.eq(it) },
8088 isUnread(condition.isRead, userId),
8189 contentEntity.deleted.isFalse,
8290 dateBetween(condition.startDate, condition.endDate),
8391 categoryIn(condition.categoryIds),
8492 containsWord(condition.searchWord),
85- contentEntity.deleted.isFalse,
8693 )
8794 .offset(pageable.offset)
8895 .groupBy(contentEntity)
0 commit comments