Skip to content

Commit

Permalink
fix: exclude deleted (though exists in database) posts from retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
becooq81 committed Jul 25, 2024
1 parent 567516a commit 3154abd
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@

@Repository
public interface PostRepository extends JpaRepository<Post, Long>, PagingAndSortingRepository<Post, Long>, JpaSpecificationExecutor<Post> {
@Query("select p from Post p where p.member=:member and p.isDeleted=false")
Page<Post> findByMember(Member member, Pageable pageable);

@Query("select p from Post p where p.boardType=:boardType and p.isDeleted=false")
Page<Post> findByBoardType(@Param("boardType") BoardType boardType, Pageable pageable);

@Query("select p from Post p where (p.title like %:title% or p.body like %:body%) and p.isDeleted = false")
Page<Post> findByTitleContainingOrBodyContaining(String title, String body, Pageable pageable);

}

0 comments on commit 3154abd

Please sign in to comment.