Skip to content

Commit

Permalink
Merge pull request #87 from hook-killer/feat/86-mypagelist
Browse files Browse the repository at this point in the history
[FIX] 마이페이지 리스트 조회 이슈 수정
  • Loading branch information
donsonioc2010 authored Oct 24, 2023
2 parents fcc36fa + f57647e commit 9b7a7f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public interface ArticleRepository extends JpaRepository<Article, Long> {

Page<Article> findAllByCreatedUserOrderByCreateAtDesc(User user, Pageable pageable);

Page<Article> findAllByCreatedUserAndArticleStatusOrderByCreateAtDesc(User user, ArticleStatus status, Pageable pageable);

Page<Article> findAllByBoardAndArticleStatusAndCreateAtBetweenOrderByLikeCountDesc(
Board board, ArticleStatus status, Timestamp startTimestamp, Timestamp endTimestamp, Pageable pageable
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ public interface ReplyRepository extends JpaRepository<Reply, Long> {
List<Reply> findAllByArticleAndReplyStatus(Article article, ReplyStatus replyStatus);

Page<Reply> findAllByCreatedUserOrderByCreateAtDesc(User user, Pageable pageable);

Page<Reply> findAllByCreatedUserAndReplyStatusOrderByCreateAtDesc(User user, ReplyStatus replyStatus, Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import HookKiller.server.board.repository.ArticleRepository;
import HookKiller.server.board.repository.ReplyContentRepository;
import HookKiller.server.board.repository.ReplyRepository;
import HookKiller.server.board.type.ReplyStatus;
import HookKiller.server.common.dto.CommonBooleanResultResponse;
import HookKiller.server.common.exception.BadTypeRequestException;
import HookKiller.server.common.type.ArticleStatus;
import HookKiller.server.common.type.LanguageType;
import HookKiller.server.common.util.UserUtils;
import HookKiller.server.user.dto.MyPageUserUpdateRequest;
Expand Down Expand Up @@ -76,7 +78,7 @@ public Object getMyCreatedList(int page, int limit, String searchType, LanguageT
User user = userUtils.getUser();
Pageable pageable = PageRequest.of(page, limit);
if(searchType.equalsIgnoreCase("ARTICLE")) {
return articleRepository.findAllByCreatedUserOrderByCreateAtDesc(user, pageable)
return articleRepository.findAllByCreatedUserAndArticleStatusOrderByCreateAtDesc(user, ArticleStatus.PUBLIC, pageable)
.stream().map(
article -> ArticleRequestDto.of(article, articleContentRepository
.findByArticleAndLanguage(article, language)
Expand All @@ -85,7 +87,7 @@ public Object getMyCreatedList(int page, int limit, String searchType, LanguageT
}

if(searchType.equalsIgnoreCase("REPLY")){
return replyRepository.findAllByCreatedUserOrderByCreateAtDesc(user, pageable)
return replyRepository.findAllByCreatedUserAndReplyStatusOrderByCreateAtDesc(user, ReplyStatus.USABLE, pageable)
.stream()
.map(reply ->
ReplyResponseDto.of(
Expand Down

0 comments on commit 9b7a7f9

Please sign in to comment.