refactor: rename stats to dashboard stats (#2609)

#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
修改仪表盘统计返回类型的名称避类名相同时 swagger api 的 schema 被覆盖
#### Which issue(s) this PR fixes:

Fixes #

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/2612/head
guqing 2022-10-20 11:54:13 +08:00 committed by GitHub
parent 0f9c73ac8e
commit ec7dc8445f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public class StatsEndpoint implements CustomEndpoint {
.description("Get stats.") .description("Get stats.")
.tag(tag) .tag(tag)
.response(responseBuilder() .response(responseBuilder()
.implementation(Stats.class) .implementation(DashboardStats.class)
) )
) )
.build(); .build();
@ -45,7 +45,7 @@ public class StatsEndpoint implements CustomEndpoint {
Mono<ServerResponse> getStats(ServerRequest request) { Mono<ServerResponse> getStats(ServerRequest request) {
return client.list(Counter.class, null, null) return client.list(Counter.class, null, null)
.reduce(Stats.emptyStats(), (stats, counter) -> { .reduce(DashboardStats.emptyStats(), (stats, counter) -> {
stats.setVisits(stats.getVisits() + counter.getVisit()); stats.setVisits(stats.getVisits() + counter.getVisit());
stats.setComments(stats.getComments() + counter.getTotalComment()); stats.setComments(stats.getComments() + counter.getTotalComment());
stats.setApprovedComments( stats.setApprovedComments(
@ -72,7 +72,7 @@ public class StatsEndpoint implements CustomEndpoint {
} }
@Data @Data
public static class Stats { public static class DashboardStats {
private Integer visits; private Integer visits;
private Integer comments; private Integer comments;
private Integer approvedComments; private Integer approvedComments;
@ -85,8 +85,8 @@ public class StatsEndpoint implements CustomEndpoint {
* *
* @return stats with initialize value. * @return stats with initialize value.
*/ */
public static Stats emptyStats() { public static DashboardStats emptyStats() {
Stats stats = new Stats(); DashboardStats stats = new DashboardStats();
stats.setVisits(0); stats.setVisits(0);
stats.setComments(0); stats.setComments(0);
stats.setApprovedComments(0); stats.setApprovedComments(0);