mirror of https://github.com/halo-dev/halo
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
parent
0f9c73ac8e
commit
ec7dc8445f
|
@ -37,7 +37,7 @@ public class StatsEndpoint implements CustomEndpoint {
|
|||
.description("Get stats.")
|
||||
.tag(tag)
|
||||
.response(responseBuilder()
|
||||
.implementation(Stats.class)
|
||||
.implementation(DashboardStats.class)
|
||||
)
|
||||
)
|
||||
.build();
|
||||
|
@ -45,7 +45,7 @@ public class StatsEndpoint implements CustomEndpoint {
|
|||
|
||||
Mono<ServerResponse> getStats(ServerRequest request) {
|
||||
return client.list(Counter.class, null, null)
|
||||
.reduce(Stats.emptyStats(), (stats, counter) -> {
|
||||
.reduce(DashboardStats.emptyStats(), (stats, counter) -> {
|
||||
stats.setVisits(stats.getVisits() + counter.getVisit());
|
||||
stats.setComments(stats.getComments() + counter.getTotalComment());
|
||||
stats.setApprovedComments(
|
||||
|
@ -72,7 +72,7 @@ public class StatsEndpoint implements CustomEndpoint {
|
|||
}
|
||||
|
||||
@Data
|
||||
public static class Stats {
|
||||
public static class DashboardStats {
|
||||
private Integer visits;
|
||||
private Integer comments;
|
||||
private Integer approvedComments;
|
||||
|
@ -85,8 +85,8 @@ public class StatsEndpoint implements CustomEndpoint {
|
|||
*
|
||||
* @return stats with initialize value.
|
||||
*/
|
||||
public static Stats emptyStats() {
|
||||
Stats stats = new Stats();
|
||||
public static DashboardStats emptyStats() {
|
||||
DashboardStats stats = new DashboardStats();
|
||||
stats.setVisits(0);
|
||||
stats.setComments(0);
|
||||
stats.setApprovedComments(0);
|
||||
|
|
Loading…
Reference in New Issue