Skip to content

Commit

Permalink
Merge pull request #74 from DEPthes/develop
Browse files Browse the repository at this point in the history
[DEPLOY]
  • Loading branch information
jisujeong0 authored Aug 20, 2024
2 parents 51892f1 + 59b0966 commit ad905d2
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ private void sortBoardLikes(List<BoardLikeByUserRes> boardLikeByUserResList, Str
boardLikeByUserResList.sort(Comparator.comparing(BoardLikeByUserRes::getCreatedDate, Comparator.reverseOrder()));
break;
case "like":
boardLikeByUserResList.sort(Comparator.comparing(BoardLikeByUserRes::getCountLike, Comparator.reverseOrder()));
boardLikeByUserResList.sort(
Comparator.comparing(BoardLikeByUserRes::getCountLike, Comparator.reverseOrder())
.thenComparing(BoardLikeByUserRes::getCreatedDate, Comparator.reverseOrder())
);
break;
default:
throw new InvalidParameterException("잘못된 요청 파라미터입니다.");
Expand Down Expand Up @@ -233,10 +236,16 @@ private void sortThemeLikes(List<ThemeLikeByUserRes> themeLikeByUserResList, Str
themeLikeByUserResList.sort(Comparator.comparing(ThemeLikeByUserRes::getDate, Comparator.reverseOrder()));
break;
case "like":
themeLikeByUserResList.sort(Comparator.comparing(ThemeLikeByUserRes::getCountLike, Comparator.reverseOrder()));
themeLikeByUserResList.sort(
Comparator.comparing(ThemeLikeByUserRes::getCountLike, Comparator.reverseOrder())
.thenComparing(ThemeLikeByUserRes::getDate, Comparator.reverseOrder())
);
break;
case "board":
themeLikeByUserResList.sort(Comparator.comparing(ThemeLikeByUserRes::getCountBoard, Comparator.reverseOrder()));
themeLikeByUserResList.sort(
Comparator.comparing(ThemeLikeByUserRes::getCountBoard, Comparator.reverseOrder())
.thenComparing(ThemeLikeByUserRes::getDate, Comparator.reverseOrder())
);
break;
default:
throw new InvalidParameterException("잘못된 요청 파라미터입니다.");
Expand Down Expand Up @@ -324,7 +333,10 @@ public ResponseEntity<?> getMyBoards(CustomUserDetails customUserDetails, int pa
break;
case "like":
myBoardResList = sortByLike(user, filterDrafts, null);
myBoardResList.sort(Comparator.comparing(MyBoardRes::getCountLike, Comparator.reverseOrder()));
myBoardResList.sort(
Comparator.comparing(MyBoardRes::getCountLike, Comparator.reverseOrder())
.thenComparing(MyBoardRes::getCreatedDate, Comparator.reverseOrder())
);
myBoardResList = applyPagination(myBoardResList, page, size);
break;
default:
Expand Down Expand Up @@ -364,8 +376,10 @@ public ResponseEntity<?> searchMyBoards(CustomUserDetails customUserDetails, int
break;
case "like":
myBoardResList = sortByLike(user, filterDrafts, keyword);
myBoardResList.sort(Comparator.comparing(MyBoardRes::getCountLike, Comparator.reverseOrder())
.thenComparing(MyBoardRes::getCreatedDate, Comparator.reverseOrder()));
myBoardResList.sort(
Comparator.comparing(MyBoardRes::getCountLike, Comparator.reverseOrder())
.thenComparing(MyBoardRes::getCreatedDate, Comparator.reverseOrder())
);
myBoardResList = applyPagination(myBoardResList, page, size);
break;
default:
Expand Down

0 comments on commit ad905d2

Please sign in to comment.