From ec7dc8445f691f75b39e1c485ea62c42235b8672 Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Thu, 20 Oct 2022 11:54:13 +0800 Subject: [PATCH] refactor: rename stats to dashboard stats (#2609) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### 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 ``` --- .../app/core/extension/endpoint/StatsEndpoint.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java b/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java index 379bef8d8..6f3ccd571 100644 --- a/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java +++ b/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java @@ -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 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);