From 77d6ea8890127b5bbce398b91182ce3ce6c31a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 15 Dec 2021 11:06:26 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Christy Jacob --- app/controllers/api/health.php | 6 +++--- src/Appwrite/Utopia/Response/Model/HealthAntiVirus.php | 10 +++++----- src/Appwrite/Utopia/Response/Model/HealthStatus.php | 2 +- src/Appwrite/Utopia/Response/Model/HealthTime.php | 4 ++-- src/Appwrite/Utopia/Response/Model/HealthVersion.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 498904a834..ed2be6dc78 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -355,15 +355,15 @@ App::get('/v1/health/anti-virus') (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)); try { - $output['version'] = @$antiVirus->version(); - $output['status'] = (@$antiVirus->ping()) ? 'pass' : 'fail'; + $output['version'] = @$antivirus->version(); + $output['status'] = (@$antivirus->ping()) ? 'pass' : 'fail'; } catch( \Exception $e) { $output['status'] = 'offline'; $output['version'] = ''; } } - $response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS); + $response->dynamic(new Document($output), Response::MODEL_HEALTH_ANTIVIRUS); }); App::get('/v1/health/stats') // Currently only used internally diff --git a/src/Appwrite/Utopia/Response/Model/HealthAntiVirus.php b/src/Appwrite/Utopia/Response/Model/HealthAntiVirus.php index 16fea9af39..26bc8f8279 100644 --- a/src/Appwrite/Utopia/Response/Model/HealthAntiVirus.php +++ b/src/Appwrite/Utopia/Response/Model/HealthAntiVirus.php @@ -5,20 +5,20 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; -class HealthAntiVirus extends Model +class HealthAntivirus extends Model { public function __construct() { $this ->addRule('version', [ 'type' => self::TYPE_STRING, - 'description' => 'AntiVirus version.', + 'description' => 'Antivirus version.', 'default' => '', 'example' => '1.0.0', ]) ->addRule('status', [ 'type' => self::TYPE_STRING, - 'description' => 'AntiVirus status. Possible values can are: `disabled`, `offline`, `online`', + 'description' => 'Antivirus status. Possible values can are: `disabled`, `offline`, `online`', 'default' => '', 'example' => 'online', ]) @@ -32,11 +32,11 @@ class HealthAntiVirus extends Model */ public function getName():string { - return 'Health AntiVirus'; + return 'Health Antivirus'; } /** - * Get Collection + * Get Type * * @return string */ diff --git a/src/Appwrite/Utopia/Response/Model/HealthStatus.php b/src/Appwrite/Utopia/Response/Model/HealthStatus.php index 46faf061c8..4414b7b8e8 100644 --- a/src/Appwrite/Utopia/Response/Model/HealthStatus.php +++ b/src/Appwrite/Utopia/Response/Model/HealthStatus.php @@ -10,7 +10,7 @@ class HealthStatus extends Model public function __construct() { $this - ->addRule('checkTime', [ + ->addRule('ping', [ 'type' => self::TYPE_INTEGER, 'description' => 'Duration in milliseconds how long the health check took.', 'default' => 0, diff --git a/src/Appwrite/Utopia/Response/Model/HealthTime.php b/src/Appwrite/Utopia/Response/Model/HealthTime.php index 18894ee305..95f9c315dd 100644 --- a/src/Appwrite/Utopia/Response/Model/HealthTime.php +++ b/src/Appwrite/Utopia/Response/Model/HealthTime.php @@ -10,13 +10,13 @@ class HealthTime extends Model public function __construct() { $this - ->addRule('remote', [ + ->addRule('remoteTime', [ 'type' => self::TYPE_INTEGER, 'description' => 'Current unix timestamp on trustful remote server.', 'default' => 0, 'example' => 1639490751, ]) - ->addRule('local', [ + ->addRule('localTime', [ 'type' => self::TYPE_INTEGER, 'description' => 'Current unix timestamp of local server where Appwrite runs.', 'default' => 0, diff --git a/src/Appwrite/Utopia/Response/Model/HealthVersion.php b/src/Appwrite/Utopia/Response/Model/HealthVersion.php index 2ce9b13096..fed63714c5 100644 --- a/src/Appwrite/Utopia/Response/Model/HealthVersion.php +++ b/src/Appwrite/Utopia/Response/Model/HealthVersion.php @@ -30,7 +30,7 @@ class HealthVersion extends Model } /** - * Get Collection + * Get Type * * @return string */