Skip to content

Commit

Permalink
[release-2.0] feat: archives in descending order by month (#2975)
Browse files Browse the repository at this point in the history
This is an automated cherry-pick of #2959

/assign JohnNiang

```release-note
归档数据按月降序
```
  • Loading branch information
halo-dev-bot committed Dec 16, 2022
1 parent 676f2c7 commit 8cbf16a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,13 @@ public Mono<ListResult<PostArchiveVo>> archives(Integer page, Integer size, Stri
// convert to archive year month value objects
List<PostArchiveYearMonthVo> monthArchives = monthPosts.entrySet()
.stream()
.sorted(Map.Entry.comparingByKey())
.map(monthEntry -> PostArchiveYearMonthVo.builder()
.posts(monthEntry.getValue())
.month(monthEntry.getKey())
.build()
)
.sorted(
Comparator.comparing(PostArchiveYearMonthVo::getMonth).reversed())
.toList();
return PostArchiveVo.builder()
.year(String.valueOf(key))
Expand Down

0 comments on commit 8cbf16a

Please sign in to comment.