Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.springframework.data.jpa.repository.Query;

public interface CommunityRepository extends JpaRepository<Community, Long> {
Page<Community> findAllByCommunityCategory(CommunityCategory category, Pageable pageable);
Page<Community> findAllByCommunityCategoryOrderByCreatedAtDesc(CommunityCategory category, Pageable pageable);

// Page<Community> findAllByUserId(Long userId, Pageable pageable);
@EntityGraph(attributePaths = {"user"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public CommunityResponseDTO.CreatedPostDTO createCommunityPost(String userId, Lo
public CommunityResponseDTO.PostListDTO getCommunityList(String userId, Long categoryId, Integer page, Integer size) {
User user = userRepository.findByEmail(userId).orElseThrow(() -> new GeneralException(ErrorStatus.USER_NOT_FOUND));
CommunityCategory communityCategory = CommunityConverter.toCommunityCategory(categoryId);
Page<Community> communityList = communityRepository.findAllByCommunityCategory(communityCategory, PageRequest.of(page, size));
Page<Community> communityList = communityRepository.findAllByCommunityCategoryOrderByCreatedAtDesc(communityCategory, PageRequest.of(page, size));
return CommunityConverter.toPostListDTO(communityList, categoryId);
}

Expand Down
Loading